Moving from govendor to dep, updated dependencies (#48)

* Moving from govendor to dep.

* Making the pull request template more friendly.

* Fixing akward space in PR template.

* goimports run on whole project using ` goimports -w $(find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./gen-go/*")`

source of command: https://gist.github.com/bgentry/fd1ffef7dbde01857f66
This commit is contained in:
Renan DelValle 2018-01-07 13:13:47 -08:00 committed by GitHub
parent 9631aa3aab
commit 8d445c1c77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2186 changed files with 400410 additions and 352 deletions

View file

@ -0,0 +1,76 @@
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--
import qualified Calculator
import qualified Calculator_Client as Client
import qualified SharedService_Client as SClient
import Tutorial_Types
import SharedService_Iface
import Shared_Types
import Thrift
import Thrift.Protocol.Binary
import Thrift.Transport
import Thrift.Transport.Handle
import Thrift.Server
import Control.Exception
import Data.Maybe
import Data.Text.Lazy
import Text.Printf
import Network
main = do
transport <- hOpen ("localhost", PortNumber 9090)
let binProto = BinaryProtocol transport
let client = (binProto, binProto)
Client.ping client
print "ping()"
sum <- Client.add client 1 1
printf "1+1=%d\n" sum
let work = Work { work_op = DIVIDE,
work_num1 = 1,
work_num2 = 0,
work_comment = Nothing
}
Control.Exception.catch (printf "1/0=%d\n" =<< Client.calculate client 1 work)
(\e -> printf "InvalidOperation %s\n" (show (e :: InvalidOperation)))
let work = Work { work_op = SUBTRACT,
work_num1 = 15,
work_num2 = 10,
work_comment = Nothing
}
diff <- Client.calculate client 1 work
printf "15-10=%d\n" diff
log <- SClient.getStruct client 1
printf "Check log: %s\n" $ unpack $ sharedStruct_value log
-- Close!
tClose transport

View file

@ -0,0 +1,103 @@
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--
{-# LANGUAGE OverloadedStrings #-}
import qualified Calculator
import Calculator_Iface
import Tutorial_Types
import SharedService_Iface
import Shared_Types
import Thrift
import Thrift.Protocol.Binary
import Thrift.Transport
import Thrift.Server
import Data.Int
import Data.String
import Data.Maybe
import Text.Printf
import Control.Exception (throw)
import Control.Concurrent.MVar
import qualified Data.Map as M
import Data.Map ((!))
import Data.Monoid
data CalculatorHandler = CalculatorHandler {mathLog :: MVar (M.Map Int32 SharedStruct)}
newCalculatorHandler = do
log <- newMVar mempty
return $ CalculatorHandler log
instance SharedService_Iface CalculatorHandler where
getStruct self k = do
myLog <- readMVar (mathLog self)
return $ (myLog ! k)
instance Calculator_Iface CalculatorHandler where
ping _ =
print "ping()"
add _ n1 n2 = do
printf "add(%d,%d)\n" n1 n2
return (n1 + n2)
calculate self mlogid mwork = do
printf "calculate(%d, %s)\n" logid (show work)
let val = case op work of
ADD ->
num1 work + num2 work
SUBTRACT ->
num1 work - num2 work
MULTIPLY ->
num1 work * num2 work
DIVIDE ->
if num2 work == 0 then
throw $
InvalidOperation {
invalidOperation_whatOp = fromIntegral $ fromEnum $ op work,
invalidOperation_why = "Cannot divide by 0"
}
else
num1 work `div` num2 work
let logEntry = SharedStruct logid (fromString $ show $ val)
modifyMVar_ (mathLog self) $ return .(M.insert logid logEntry)
return $! val
where
-- stupid dynamic languages f'ing it up
num1 = work_num1
num2 = work_num2
op = work_op
logid = mlogid
work = mwork
zip _ =
print "zip()"
main = do
handler <- newCalculatorHandler
print "Starting the server..."
runBasicServer handler Calculator.process 9090
print "done."

39
vendor/git.apache.org/thrift.git/tutorial/hs/Makefile.am generated vendored Executable file
View file

@ -0,0 +1,39 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
all-local:
$(top_builddir)/compiler/cpp/thrift --gen hs -r $(top_srcdir)/tutorial/tutorial.thrift
$(CABAL) install
install-exec-hook:
$(CABAL) install
# Make sure this doesn't fail if Haskell is not configured.
clean-local:
$(CABAL) clean
$(RM) -r gen-*
check-local:
$(CABAL) check
tutorialserver: all
dist/build/HaskellServer/HaskellServer
tutorialclient: all
dist/build/HaskellClient/HaskellClient

21
vendor/git.apache.org/thrift.git/tutorial/hs/Setup.lhs generated vendored Normal file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env runhaskell
> -- Licensed to the Apache Software Foundation (ASF) under one
> -- or more contributor license agreements. See the NOTICE file
> -- distributed with this work for additional information
> -- regarding copyright ownership. The ASF licenses this file
> -- to you under the Apache License, Version 2.0 (the
> -- "License"); you may not use this file except in compliance
> -- with the License. You may obtain a copy of the License at
> --
> -- http://www.apache.org/licenses/LICENSE-2.0
> --
> -- Unless required by applicable law or agreed to in writing,
> -- software distributed under the License is distributed on an
> -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> -- KIND, either express or implied. See the License for the
> -- specific language governing permissions and limitations
> -- under the License.
> import Distribution.Simple
> main = defaultMain

View file

@ -0,0 +1,73 @@
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--
Name: ThriftTutorial
Version: 0.10.0
Cabal-Version: >= 1.4
License: OtherLicense
Category: Foreign
Build-Type: Simple
Synopsis: Thrift Tutorial library package
Homepage: http://thrift.apache.org
Bug-Reports: https://issues.apache.org/jira/browse/THRIFT
Maintainer: dev@thrift.apache.org
License-File: ../../LICENSE
Description:
Haskell tutorial for the Apache Thrift RPC system. Requires the use of the thrift code generator.
flag network-uri
description: Get Network.URI from the network-uri package
default: True
Executable HaskellServer
Main-is: HaskellServer.hs
Hs-Source-Dirs:
., gen-hs/
Build-Depends:
base >= 4, base < 5, ghc-prim, containers, thrift, vector, unordered-containers, text, hashable, bytestring, QuickCheck
Extensions:
DeriveDataTypeable,
ExistentialQuantification,
FlexibleInstances,
KindSignatures,
MagicHash,
RankNTypes,
ScopedTypeVariables,
TypeSynonymInstances
Executable HaskellClient
Main-is: HaskellClient.hs
Hs-Source-Dirs:
., gen-hs/
Build-Depends:
base >= 4, base < 5, ghc-prim, containers, thrift, vector, QuickCheck
if flag(network-uri)
build-depends: network-uri >= 2.6, network >= 2.6
else
build-depends: network < 2.6
Extensions:
DeriveDataTypeable,
ExistentialQuantification,
FlexibleInstances,
KindSignatures,
MagicHash,
RankNTypes,
ScopedTypeVariables,
TypeSynonymInstances