Skip to content

Commit

Permalink
build with go 1.11.x (AthenZ#579)
Browse files Browse the repository at this point in the history
  • Loading branch information
havetisyan authored Oct 15, 2018
1 parent ed77fb8 commit 2f2be63
Show file tree
Hide file tree
Showing 19 changed files with 155 additions and 504 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cache:
directories:
- "$HOME/.m2"
before_install:
- eval "$(gimme 1.10.4)"
- eval "$(gimme 1.11.1)"
- nvm install 6
- npm install -g npm@latest
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
Expand Down
2 changes: 1 addition & 1 deletion clients/go/zms/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ build: src/$(RDL_LIB)

src/$(RDL_LIB):
go get $(RDL_LIB)
go get github.com/ardielle/ardielle-tools/...
go get github.com/ardielle/ardielle-tools

model.go: $(RDL_FILE)
$(GOPATH)/bin/rdl -ps generate -t -o $@ go-model $(RDL_FILE)
Expand Down
24 changes: 0 additions & 24 deletions clients/go/zts/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@ module github.com/yahoo/athenz
require (
github.com/BurntSushi/toml v0.3.0 // indirect
github.com/ardielle/ardielle-go v1.5.1
github.com/ardielle/ardielle-tools v1.14.15 // indirect
github.com/boynton/repl v0.0.0-20170116235056-348863958e3e
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.1
github.com/dimfeld/httptreemux v5.0.1+incompatible
github.com/gorilla/context v1.1.1 // indirect
github.com/gorilla/mux v1.6.2
github.com/natefinch/lumberjack v2.0.0+incompatible
github.com/pmezard/go-difflib v1.0.0
github.com/stretchr/objx v0.1.1
github.com/stretchr/testify v1.2.2
golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b
golang.org/x/net v0.0.0-20180921000356-2f5d2388922f
golang.org/x/sys v0.0.0-20180920110915-d641721ec2de // indirect
golang.org/x/sys v0.0.0-20180920110915-d641721ec2de
golang.org/x/text v0.3.0
golang.org/x/tools v0.0.0-20181012201414-c0eb142035b5
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/yaml.v2 v2.2.1
)
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ github.com/BurntSushi/toml v0.3.0 h1:e1/Ivsx3Z0FVTV0NSOv/aVgbUWyQuzj7DDnFblkRvsY
github.com/BurntSushi/toml v0.3.0/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/ardielle/ardielle-go v1.5.1 h1:7vSvfYuByBHGSk+8am0u2DT92+95UFtxdp5fkSEQTII=
github.com/ardielle/ardielle-go v1.5.1/go.mod h1:I4hy1n795cUhaVt/ojz83SNVCYIGsAFAONtv2Dr7HUI=
github.com/ardielle/ardielle-tools v1.14.15 h1:BukXV+2FhI3mXbb4x9HdfTDfe9bC2yBhRWxk3Kl9yUA=
github.com/ardielle/ardielle-tools v1.14.15/go.mod h1:md5tB6Ld1xXeYT0iETNHj4/Dm+funcuxeZn2yXWmvCY=
github.com/boynton/repl v0.0.0-20170116235056-348863958e3e h1:lFJi7V/jlH3FDeZxW0o/oMfKAjPyc/yifX2z8eBeLt8=
github.com/boynton/repl v0.0.0-20170116235056-348863958e3e/go.mod h1:Crc/GCZ3NXDVCio7Yr0o+SSrytpcFhLmVCIzi0s49t4=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand All @@ -12,10 +14,14 @@ github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/mux v1.6.2 h1:Pgr17XVTNXAk3q/r4CpKzC5xBM/qW1uVLV+IhRZpIIk=
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/jawher/mow.cli v1.0.4 h1:hKjm95J7foZ2ngT8tGb15Aq9rj751R7IUDjG+5e3cGA=
github.com/jawher/mow.cli v1.0.4/go.mod h1:5hQj2V8g+qYmLUVWqu4Wuja1pI57M83EChYLVZ0sMKk=
github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM=
github.com/natefinch/lumberjack v2.0.0+incompatible/go.mod h1:Wi9p2TTF5DG5oU+6YfsmYQpsTIOm0B1VNzQg9Mw6nPk=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b h1:2b9XGzhjiYsYPnKXoEfL7klWZQIt8IfyRCz62gCqqlQ=
Expand All @@ -24,6 +30,10 @@ golang.org/x/net v0.0.0-20180921000356-2f5d2388922f h1:QM2QVxvDoW9PFSPp/zy9FgxJL
golang.org/x/net v0.0.0-20180921000356-2f5d2388922f/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/sys v0.0.0-20180920110915-d641721ec2de h1:soC2mvPVpAV+Ld2qtpNn1eq25WTn76uIGNV23bofu6Q=
golang.org/x/sys v0.0.0-20180920110915-d641721ec2de/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20181012201414-c0eb142035b5 h1:7biR/1TVYwx5G88SZ6YJWFybYq6HoQaa9VnemnXgyLo=
golang.org/x/tools v0.0.0-20181012201414-c0eb142035b5/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=
Expand Down
53 changes: 14 additions & 39 deletions libs/go/athenzconf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,25 @@
#

GOPKGNAME = github.com/yahoo/athenz/libs/go/athenzconf
PKG_DATE=$(shell date '+%Y-%m-%dT%H:%M:%S')
BINARY=athenzconf
FMT_LOG=/tmp/athenzconf-fmt.log
IMPORTS_LOG=/tmp/athenzconf-imports.log

# check to see if go utility is installed
GO := $(shell command -v go 2> /dev/null)
export GOPATH=$(PWD)

ifdef GO

# we need to make sure we have go 1.7+
# we need to make sure we have go 1.11+
# the output for the go version command is:
# go version go1.7.3 darwin/amd64
# go version go1.11.1 darwin/amd64

GO_VER_GTEQ7 := $(shell expr `go version | cut -f 3 -d' ' | cut -f2 -d.` \>= 7)
ifneq "$(GO_VER_GTEQ7)" "1"
GO_VER_GTEQ11 := $(shell expr `go version | cut -f 3 -d' ' | cut -f2 -d.` \>= 11)
ifneq "$(GO_VER_GTEQ11)" "1"
all:
@echo "Please install 1.7.x or newer version of golang"
@echo "Please install 1.11.x or newer version of golang"
else

.PHONY: source vet fmt imports build
all: source vet fmt imports build
.PHONY: vet fmt build test
all: vet fmt build test

endif

Expand All @@ -40,39 +36,18 @@ all:

endif

# we need to build the athenzconf with the local copy.
# So we are going to copy the source directories
# into our source tree and compile them
source:
@echo "Cleanup up local GOPATH src directory..."
rm -rf src
@echo "Setting up the source code..."
mkdir -p /tmp/athenzconf-build/src/$(GOPKGNAME)
cp -r * /tmp/athenzconf-build/src/$(GOPKGNAME)/.
mv /tmp/athenzconf-build/src .
@echo "Copying local source files..."
mkdir -p $(GOPATH)/src/github.com/yahoo/athenz/libs/go
cp -r ../../../libs/go/zmssvctoken $(GOPATH)/src/github.com/yahoo/athenz/libs/go
@echo "Getting dependency packages..."
go get -t -d -tags testing $(GOPKGNAME)/...

vet:
go vet $(GOPKGNAME)/...
go vet .

# we are going to verify our library
fmt:
go list $(GOPKGNAME)/... | sed "s:^:$(GOPATH)/src/:" | xargs gofmt -d >$(FMT_LOG)
@if [ -s $(FMT_LOG) ]; then echo gofmt FAIL; cat $(FMT_LOG); false; fi

# we are going to verify our library
imports:
go get golang.org/x/tools/cmd/goimports
go list $(GOPKGNAME)/... | sed "s:^:$(GOPATH)/src/:" | xargs $(GOPATH)/bin/goimports -d >$(IMPORTS_LOG)
@if [ -s $(IMPORTS_LOG) ]; then echo goimports FAIL; cat $(IMPORTS_LOG); false; fi
gofmt -l .

build:
@echo "Building athenzconf library..."
go install -v $(GOPKGNAME)/...
go install -v $(GOPKGNAME)

test:
go test -v $(GOPKGNAME)

clean:
rm -rf target src bin pkg /tmp/athenzconf-build $(FMT_LOG) $(IMPORTS_LOG)
rm -rf target
51 changes: 12 additions & 39 deletions libs/go/zmscli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,25 @@
#

GOPKGNAME = github.com/yahoo/athenz/libs/go/zmscli
PKG_DATE=$(shell date '+%Y-%m-%dT%H:%M:%S')
BINARY=zmscli
FMT_LOG=/tmp/zmscli-fmt.log
IMPORTS_LOG=/tmp/zmscli-imports.log

# check to see if go utility is installed
GO := $(shell command -v go 2> /dev/null)
export GOPATH=$(PWD)

ifdef GO

# we need to make sure we have go 1.7+
# we need to make sure we have go 1.11+
# the output for the go version command is:
# go version go1.7.3 darwin/amd64
# go version go1.11.1 darwin/amd64

GO_VER_GTEQ7 := $(shell expr `go version | cut -f 3 -d' ' | cut -f2 -d.` \>= 7)
ifneq "$(GO_VER_GTEQ7)" "1"
GO_VER_GTEQ11 := $(shell expr `go version | cut -f 3 -d' ' | cut -f2 -d.` \>= 11)
ifneq "$(GO_VER_GTEQ11)" "1"
all:
@echo "Please install 1.7.x or newer version of golang"
@echo "Please install 1.11.x or newer version of golang"
else

.PHONY: source vet fmt imports build test
all: source vet fmt imports build test
.PHONY: vet fmt build test
all: vet fmt build test

endif

Expand All @@ -40,41 +36,18 @@ all:

endif

# we need to build the zmscli with the local copy
# of zms-go-client so that any changes can be reflected
# right away. So we are going to copy the source directories
# into our source tree and compile them
source:
@echo "Cleanup up local GOPATH src directory..."
rm -rf src
@echo "Setting up the source code..."
mkdir -p /tmp/zmscli-build/src/$(GOPKGNAME)
cp -r * /tmp/zmscli-build/src/$(GOPKGNAME)/.
mv /tmp/zmscli-build/src .
@echo "Copying local source files..."
mkdir -p $(GOPATH)/src/github.com/yahoo/athenz/clients/go
cp -r ../../../clients/go/zms $(GOPATH)/src/github.com/yahoo/athenz/clients/go
@echo "Getting dependency packages..."
go get -t -d -tags testing $(GOPKGNAME)/...

vet:
go vet $(GOPKGNAME)/...
go vet .

fmt:
go list $(GOPKGNAME)/... | sed "s:^:$(GOPATH)/src/:" | xargs gofmt -d >$(FMT_LOG)
@if [ -s $(FMT_LOG) ]; then echo gofmt FAIL; cat $(FMT_LOG); false; fi

imports:
go get golang.org/x/tools/cmd/goimports
go list $(GOPKGNAME)/... | sed "s:^:$(GOPATH)/src/:" | xargs $(GOPATH)/bin/goimports -d >$(IMPORTS_LOG)
@if [ -s $(IMPORTS_LOG) ]; then echo goimports FAIL; cat $(IMPORTS_LOG); false; fi
gofmt -l .

build:
@echo "Building zmscli library..."
go install -v $(GOPKGNAME)/...
go install -v $(GOPKGNAME)

test:
go test -v $(GOPKGNAME)/...
go test -v $(GOPKGNAME)

clean:
rm -rf target src bin pkg /tmp/zmscli-build $(FMT_LOG) $(IMPORTS_LOG)
rm -rf target
3 changes: 1 addition & 2 deletions libs/go/zmscli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ import (
"strconv"
"strings"

"golang.org/x/net/proxy"

"github.com/ardielle/ardielle-go/rdl"
"github.com/yahoo/athenz/clients/go/zms"
"golang.org/x/net/proxy"
)

type Zms struct {
Expand Down
2 changes: 1 addition & 1 deletion libs/go/zmscli/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"gopkg.in/yaml.v2"
)

// DeleteDomain dletes the given ZMS domain.
// DeleteDomain deletes the given ZMS domain.
func (cli Zms) DeleteDomain(dn string) (*string, error) {
_, err := cli.Zms.GetDomain(zms.DomainName(dn))
if err == nil {
Expand Down
53 changes: 12 additions & 41 deletions libs/go/zmssvctoken/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,25 @@
#

GOPKGNAME = github.com/yahoo/athenz/libs/go/zmssvctoken
PKG_DATE=$(shell date '+%Y-%m-%dT%H:%M:%S')
BINARY=zmssvctoken
FMT_LOG=/tmp/zmssvctoken-fmt.log
IMPORTS_LOG=/tmp/zmssvctoken-imports.log

# check to see if go utility is installed
GO := $(shell command -v go 2> /dev/null)
export GOPATH=$(PWD)

ifdef GO

# we need to make sure we have go 1.7+
# we need to make sure we have go 1.11+
# the output for the go version command is:
# go version go1.7.3 darwin/amd64
# go version go1.11.1 darwin/amd64

GO_VER_GTEQ7 := $(shell expr `go version | cut -f 3 -d' ' | cut -f2 -d.` \>= 7)
ifneq "$(GO_VER_GTEQ7)" "1"
GO_VER_GTEQ11 := $(shell expr `go version | cut -f 3 -d' ' | cut -f2 -d.` \>= 11)
ifneq "$(GO_VER_GTEQ11)" "1"
all:
@echo "Please install 1.7.x or newer version of golang"
@echo "Please install 1.11.x or newer version of golang"
else

.PHONY: source vet fmt imports build test
all: source vet fmt imports build test
.PHONY: vet fmt build test
all: vet fmt build test

endif

Expand All @@ -40,43 +36,18 @@ all:

endif

# we need to build the zmssvctoken with the local copy
# of zms-go-client so that any changes can be reflected
# right away. So we are going to copy the source directories
# into our source tree and compile them
source:
@echo "Cleanup up local GOPATH src directory..."
rm -rf src
@echo "Setting up the source code..."
mkdir -p /tmp/zmssvctoken-build/src/$(GOPKGNAME)
cp -r * /tmp/zmssvctoken-build/src/$(GOPKGNAME)/.
mv /tmp/zmssvctoken-build/src .
@echo "Copying local source files..."
mkdir -p $(GOPATH)/src/github.com/yahoo/athenz/clients/go
cp -r ../../../clients/go/zms $(GOPATH)/src/github.com/yahoo/athenz/clients/go
@echo "Getting dependency packages..."
go get -t -d -tags testing $(GOPKGNAME)/...

vet:
go vet $(GOPKGNAME)/...
go vet .

# we are going to verify our library
fmt:
go list $(GOPKGNAME)/... | sed "s:^:$(GOPATH)/src/:" | xargs gofmt -d >$(FMT_LOG)
@if [ -s $(FMT_LOG) ]; then echo gofmt FAIL; cat $(FMT_LOG); false; fi

# we are going to verify our library
imports:
go get golang.org/x/tools/cmd/goimports
go list $(GOPKGNAME)/... | sed "s:^:$(GOPATH)/src/:" | xargs $(GOPATH)/bin/goimports -d >$(IMPORTS_LOG)
@if [ -s $(IMPORTS_LOG) ]; then echo goimports FAIL; cat $(IMPORTS_LOG); false; fi
gofmt -l .

build:
@echo "Building zmssvctoken library..."
go install -v $(GOPKGNAME)/...
go install -v $(GOPKGNAME)

test:
go test -v $(GOPKGNAME)/...
go test -v $(GOPKGNAME)

clean:
rm -rf target src bin pkg /tmp/zmssvctoken-build $(FMT_LOG) $(IMPORTS_LOG)
rm -rf target
Loading

0 comments on commit 2f2be63

Please sign in to comment.