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

Upgrade dependencies and remove retracted version #6

Merged
merged 4 commits into from
May 7, 2021

Conversation

jaredledvina
Copy link
Contributor

Motivation

Currently attempting to go get this project with Go 1.16 fails with the following:

❯ go get -u github.com/minamijoyo/tflock
github.com/minamijoyo/tflock imports
	github.com/hashicorp/terraform/backend/init imports
	github.com/hashicorp/terraform/backend/remote-state/consul imports
	github.com/hashicorp/consul/api: ambiguous import: found package github.com/hashicorp/consul/api in multiple modules:
	github.com/hashicorp/consul v0.0.0-20171026175957-610f3c86a089 (/Users/jared.ledvina/go/pkg/mod/github.com/hashicorp/[email protected]/api)
	github.com/hashicorp/consul/api v1.8.1 (/Users/jared.ledvina/go/pkg/mod/github.com/hashicorp/consul/[email protected])
github.com/minamijoyo/tflock imports
	github.com/hashicorp/terraform/backend/init imports
	github.com/hashicorp/terraform/backend/remote-state/kubernetes imports
	k8s.io/client-go/kubernetes/typed/coordination/v1: cannot find module providing package k8s.io/client-go/kubernetes/typed/coordination/v1
github.com/minamijoyo/tflock imports
	github.com/hashicorp/terraform/backend/init imports
	github.com/hashicorp/terraform/backend/remote-state/kubernetes imports
	k8s.io/client-go/kubernetes imports
	k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1 imports
	k8s.io/api/admissionregistration/v1alpha1: cannot find module providing package k8s.io/api/admissionregistration/v1alpha1
github.com/minamijoyo/tflock imports
	github.com/hashicorp/terraform/backend/init imports
	github.com/hashicorp/terraform/backend/remote-state/kubernetes imports
	k8s.io/client-go/kubernetes imports
	k8s.io/client-go/kubernetes/typed/auditregistration/v1alpha1 imports
	k8s.io/api/auditregistration/v1alpha1: cannot find module providing package k8s.io/api/auditregistration/v1alpha1
github.com/minamijoyo/tflock imports
	github.com/hashicorp/terraform/backend/init imports
	github.com/hashicorp/terraform/backend/remote-state/kubernetes imports
	k8s.io/client-go/kubernetes imports
	k8s.io/client-go/kubernetes/typed/batch/v2alpha1 imports
	k8s.io/api/batch/v2alpha1: cannot find module providing package k8s.io/api/batch/v2alpha1
github.com/minamijoyo/tflock imports
	github.com/hashicorp/terraform/backend/init imports
	github.com/hashicorp/terraform/backend/remote-state/kubernetes imports
	k8s.io/client-go/kubernetes imports
	k8s.io/client-go/kubernetes/typed/settings/v1alpha1 imports
	k8s.io/api/settings/v1alpha1: cannot find module providing package k8s.io/api/settings/v1alpha1
go: warning: k8s.io/[email protected]+incompatible: retracted by module author: pre-module versions are obsolete
go: to switch to the latest unretracted version, run:
	go get k8s.io/client-go@latest

Details

The kubernetes folks have retracted many versions of the client-go library via kubernetes/kubernetes#98267. This PR attempts to remove the retracted version and upgrades the Terraform and Golang version to the latest state releases while I'm here.

I copied over the grpc & client-go replaces from https://github.com/hashicorp/terraform/blob/v0.15.1/go.mod#L141-L143 as without them go mod would complain:

diff --git a/go.mod b/go.mod
index 919dac8..bdaee91 100644
--- a/go.mod
+++ b/go.mod
@@ -2,10 +2,6 @@ module github.com/minamijoyo/tflock

 go 1.16

-replace google.golang.org/grpc v1.31.1 => google.golang.org/grpc v1.27.1
-
-replace k8s.io/client-go => k8s.io/client-go v0.0.0-20190620085101-78d2af792bab
-
 require (
        github.com/hashicorp/logutils v1.0.0
        github.com/hashicorp/terraform v0.15.1
❯ go mod tidy
go: finding module for package google.golang.org/grpc/naming
go: finding module for package k8s.io/client-go/kubernetes/typed/coordination/v1
go: finding module for package github.com/gregjones/httpcache
go: finding module for package github.com/gregjones/httpcache/diskcache
go: finding module for package github.com/peterbourgon/diskv
go: finding module for package k8s.io/api/admissionregistration/v1alpha1
go: found github.com/gregjones/httpcache in github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79
go: found github.com/gregjones/httpcache/diskcache in github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79
go: found github.com/peterbourgon/diskv in github.com/peterbourgon/diskv v2.0.1+incompatible
go: finding module for package google.golang.org/grpc/naming
go: finding module for package k8s.io/client-go/kubernetes/typed/coordination/v1
go: finding module for package k8s.io/api/admissionregistration/v1alpha1
github.com/minamijoyo/tflock imports
	github.com/hashicorp/terraform/backend/init imports
	github.com/hashicorp/terraform/backend/remote-state/kubernetes imports
	k8s.io/client-go/kubernetes/typed/coordination/v1: package k8s.io/client-go/kubernetes/typed/coordination/v1 provided by k8s.io/client-go at latest version v0.21.0 but not at required version v10.0.0+incompatible
github.com/minamijoyo/tflock imports
	github.com/hashicorp/terraform/backend/init imports
	github.com/hashicorp/terraform/backend/remote-state/kubernetes imports
	k8s.io/client-go/kubernetes imports
	k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1 imports
	k8s.io/api/admissionregistration/v1alpha1: module k8s.io/api@latest found (v0.21.0), but does not contain package k8s.io/api/admissionregistration/v1alpha1
github.com/minamijoyo/tflock imports
	github.com/hashicorp/terraform/backend/init imports
	github.com/hashicorp/terraform/backend/remote-state/etcdv2 imports
	github.com/coreos/etcd/client tested by
	github.com/coreos/etcd/client.test imports
	github.com/coreos/etcd/integration imports
	github.com/coreos/etcd/proxy/grpcproxy imports
	google.golang.org/grpc/naming: module google.golang.org/grpc@latest found (v1.37.0), but does not contain package google.golang.org/grpc/naming

@minamijoyo
Copy link
Owner

@jaredledvina Thank you for working on this. I tried to build this branch, but failed.

[tflock@pr-6|✔]$ go build
# github.com/minamijoyo/tflock
./main.go:37:35: too many arguments in call to clistate.NewLocker
        have (context.Context, time.Duration, cli.Ui, *colorstring.Colorize)
        want (time.Duration, views.StateLocker)

Terraform v0.15.0 changed the clistate.NewLocker function.

https://github.com/hashicorp/terraform/pull/27787/files#diff-d4648631daf54c861b5dc6c7301ca56bf7b0219cb3e5e939c983c19e6672d375L85-L90

Signed-off-by: Jared Ledvina <[email protected]>
@jaredledvina
Copy link
Contributor Author

@minamijoyo - Ahhh thanks, I pushed a fix that should work. While I'm not entirely familiar with the Terraform code base this seems to follow similar logic they are using. I verified this builds locally for me with Go 1.16.

Copy link
Owner

@minamijoyo minamijoyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've also built it locally with Go 1.16.3, tested it with Terraform v0.15.1 + backend s3+DynamoDB and confirmed that it works fine for me 👍 Thanks!

@minamijoyo minamijoyo merged commit 60f8e8c into minamijoyo:master May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants