Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make types a go module #461

Merged
merged 4 commits into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ GOLINES_CMD=golines
GOVERALLS_INSTALL=go install github.com/mattn/goveralls@latest
GOVERALLS_CMD=goveralls
GOLINT_CMD=go run golang.org/x/lint/golint
GO_PACKAGES=./asserter/... ./fetcher/... ./types/... ./client/... ./server/... \
GO_PACKAGES=./asserter/... ./fetcher/... ./client/... ./server/... \
./parser/... ./syncer/... ./reconciler/... ./keys/... \
./statefulsyncer/... ./storage/... ./utils/... ./constructor/... ./errors/...

GO_MOD_PACKAGES=./types/...
GO_FOLDERS=$(shell echo ${GO_PACKAGES} | sed -e "s/\.\///g" | sed -e "s/\/\.\.\.//g")
GO_MOD_FOLDERS=$(shell echo ${GO_MOD_PACKAGES} | sed -e "s/\.\///g" | sed -e "s/\/\.\.\.//g")
TEST_SCRIPT=go test ${GO_PACKAGES}
LINT_SETTINGS=golint,misspell,gocyclo,gocritic,whitespace,goconst,gocognit,bodyclose,unconvert,lll,unparam

Expand All @@ -43,6 +46,7 @@ fix-imports:

check-comments:
${GOLINT_CMD} -set_exit_status ${GO_FOLDERS} .
${GOLINT_CMD} -set_exit_status ${GO_MOD_FOLDERS} .

lint-examples:
cd examples; \
Expand Down Expand Up @@ -79,6 +83,7 @@ check-license:
shorten-lines:
${GOLINES_INSTALL}
${GOLINES_CMD} -w --shorten-comments ${GO_FOLDERS} examples
${GOLINES_CMD} -w --shorten-comments ${GO_MOD_FOLDERS}

shellcheck:
shellcheck codegen.sh
Expand Down
4 changes: 4 additions & 0 deletions codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ do
rm "types/${type}.go" && cp "templates/${type}.txt" "types/${type}.go";
done

cp "templates/go.mod.types" "types/go.mod"
cd types && go get ./...
cd ..

# Format client generated code
FORMAT_GEN="gofmt -w /local/types; gofmt -w /local/client; gofmt -w /local/server"
GOLANG_VERSION=1.18
Expand Down
6 changes: 5 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ module github.com/coinbase/rosetta-sdk-go

go 1.18

require github.com/coinbase/rosetta-sdk-go/types v0.0.0

replace github.com/coinbase/rosetta-sdk-go/types => ./types

require (
github.com/DataDog/zstd v1.5.2
github.com/Zilliqa/gozilliqa-sdk v1.2.1-0.20201201074141-dd0ecada1be6
Expand All @@ -13,7 +17,6 @@ require (
github.com/fatih/color v1.13.0
github.com/gorilla/mux v1.8.0
github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77
github.com/mitchellh/mapstructure v1.4.3
github.com/neilotoole/errgroup v0.1.6
github.com/segmentio/fasthash v1.0.3
github.com/stretchr/testify v1.7.2
Expand All @@ -38,6 +41,7 @@ require (
github.com/klauspost/compress v1.12.3 // indirect
github.com/mattn/go-colorable v0.1.9 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/objx v0.1.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs=
github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/neilotoole/errgroup v0.1.6 h1:PODGqPXdT5BC/zCYIMoTrwV+ujKcW+gBXM6Ye9Ve3R8=
github.com/neilotoole/errgroup v0.1.6/go.mod h1:Q2nLGf+594h0CLBs/Mbg6qOr7GtqDK7C2S41udRnToE=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
Expand Down
3 changes: 3 additions & 0 deletions templates/go.mod.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/coinbase/rosetta-sdk-go/types

go 1.18
5 changes: 5 additions & 0 deletions types/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/coinbase/rosetta-sdk-go/types

go 1.18

require github.com/mitchellh/mapstructure v1.5.0
2 changes: 2 additions & 0 deletions types/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=