Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

Commit

Permalink
Support Go modules
Browse files Browse the repository at this point in the history
This is mostly just adding `go.mod` and `go.sum`.  But the generate
scripts don't entirely work well with modules:

 - `rm -rf $TEMPDIR` won't work, because `${GOPATH}/pkg/mod`
   directories are chmod o-w (this can be worked around by calling
   chmod).

 - The various `go` commands put other packages in 'go.mod', which we
   don't want.

Instead of trying to adjust all of the scripts, just set
GO111MODULE=off in the Makefile when calling them.
  • Loading branch information
LukeShu committed Jan 31, 2019
1 parent 6fa0160 commit f4e2587
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ test-examples:

.PHONY: generate
generate: _output/kubernetes _output/bin/protoc _output/bin/gomvpkg _output/bin/protoc-gen-gofast _output/src/github.com/golang/protobuf
./scripts/generate.sh
go run scripts/register.go
GO111MODULE=off ./scripts/generate.sh
GO111MODULE=off go run scripts/register.go
cp scripts/json.go.partial apis/meta/v1/json.go

.PHONY: verify-generate
verify-generate: generate
./scripts/git-diff.sh

_output/bin/protoc-gen-gofast:
./scripts/go-install.sh \
GO111MODULE=off ./scripts/go-install.sh \
https://github.com/gogo/protobuf \
github.com/gogo/protobuf \
github.com/gogo/protobuf/protoc-gen-gofast \
tags/v0.5

_output/bin/gomvpkg:
./scripts/go-install.sh \
GO111MODULE=off ./scripts/go-install.sh \
https://github.com/golang/tools \
golang.org/x/tools \
golang.org/x/tools/cmd/gomvpkg \
Expand Down
7 changes: 7 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module github.com/ericchiang/k8s

require (
github.com/golang/protobuf v1.2.0
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3
golang.org/x/text v0.3.0 // indirect
)
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3 h1:ulvT7fqt0yHWzpJwI57MezWnYDVpCAYBVuYst/L+fAY=
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

0 comments on commit f4e2587

Please sign in to comment.