-
Notifications
You must be signed in to change notification settings - Fork 68
modules: update go makefile with modules support #63
Conversation
This commit updates the go init portion of the makefile to support go modules Signed-off-by: hasheddan <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see the counter-part crossplane PR in place for a full review.
@if ! `$(GO) version | grep -q -E '\bgo($(GO_SUPPORTED_VERSIONS))\b'`; then \ | ||
$(ERR) unsupported go version. Please make install one of the following supported version: '$(GO_SUPPORTED_VERSIONS)' ;\ | ||
exit 1 ;\ | ||
fi | ||
ifeq ($(GO11MODULE),on) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/golang/go/wiki/Modules#how-to-install-and-activate-module-support
The variable is GO111MODULE
(extra "1" as in 1.11
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! In response to the Crossplane PR, it is a strict dependency on build
, so it would just be scaffolding until this was merged. Last time I brought this effort forward I don't think we had it as top of priority, but I would be willing to make another push for it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My interest resurfaced when I needed to make a PR on this repo.
This PR doesn't affect me directly now. The follow-up may be a little more involved than expected. In my own tinkering with go-mod on the crossplane project I've noticed that the packages that are <1.0.0
have been updated to their latest version by go mod init
which has introduced some deprecations to address:
GO111MODULE=on make
make go.mod
08:56:45 [ .. ] go mod tidy
==> Linting /home/marques/src/crossplane/cluster/charts/crossplane
[INFO] Chart.yaml: icon is recommended
1 chart(s) linted, no failures
08:56:45 [ .. ] golangci-lint
pkg/clients/gcp/cloudsql/instance.go:49:18: SA1019: sqladmin.New is deprecated: please use NewService instead. To provide a custom HTTP client, use option.WithHTTPClient. If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. (staticcheck)
service, err := sqladmin.New(oauth2.NewClient(ctx, creds.TokenSource))
^
pkg/clients/gcp/cloudsql/user.go:46:18: SA1019: sqladmin.New is deprecated: please use NewService instead. To provide a custom HTTP client, use option.WithHTTPClient. If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. (staticcheck)
service, err := sqladmin.New(oauth2.NewClient(ctx, creds.TokenSource))
^
pkg/clients/gcp/gcp.go:135:21: SA1019: cloudresourcemanager.New is deprecated: please use NewService instead. To provide a custom HTTP client, use option.WithHTTPClient. If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. (staticcheck)
crmService, err := cloudresourcemanager.New(client)
^
pkg/clients/gcp/gcp.go:165:21: SA1019: cloudresourcemanager.New is deprecated: please use NewService instead. To provide a custom HTTP client, use option.WithHTTPClient. If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. (staticcheck)
crmService, err := cloudresourcemanager.New(client)
^
pkg/clients/gcp/gke/gke.go:54:17: SA1019: container.New is deprecated: please use NewService instead. To provide a custom HTTP client, use option.WithHTTPClient. If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. (staticcheck)
client, err := container.New(oauth2.NewClient(context.Background(), creds.TokenSource))
^
08:56:54 [FAIL]
make[2]: *** [build/makelib/golang.mk:198: go.lint] Error 1
make[1]: *** [build/makelib/common.mk:301: build.all] Error 2
make: *** [build/makelib/common.mk:311: build] Error 2
Should this be closed now that #74 is merged? |
This commit updates the go init portion of the makefile to support go modules. It is in preparation for migrating Crossplane to go modules: #534
Signed-off-by: hasheddan [email protected]