minamijoyo / tfupdate

Update version constraints in your Terraform configurations
MIT License
539 stars 23 forks source link

Fix go install error #70

Closed minamijoyo closed 2 years ago

minamijoyo commented 2 years ago

Fixes #69

If go.mod contains a replace directive, go install results in an error. The root cause of this problem is the following replace directive. https://github.com/minamijoyo/tfupdate/blob/d7750d7619866f38cf2b7039718895f1f9962dc7/go.mod#L43-L44

This replace directive was introduced as a temporary workaround for the change of pseudo-version in Go 1.13. https://github.com/minamijoyo/tfupdate/commit/31223822b1a54524c60ba15339338296d21fdfe4

Why did we depended on github.com/go-macaron/cors is that it was introduced by dependencies of goreleaser. https://github.com/minamijoyo/tfupdate/commit/8eeb285b7237665846fb60b9df34920dda8778b9

However, we are currently using goreleaser via GitHub Actions, so we have already removed the goreleaser dependency from go.mod. https://github.com/minamijoyo/tfupdate/commit/7f79068fdcc6d92184619617d17848b3ae1fb72f

That is, the replace directive is no longer needed, we can simply remove it.

before

$ go install github.com/minamijoyo/tfupdate@latest
go install: github.com/minamijoyo/tfupdate@latest (in github.com/minamijoyo/tfupdate@v0.6.4):
        The go.mod file for the module providing named packages contains one or
        more replace directives. It must not contain directives that would cause
        it to be interpreted differently than if it were the main module.

after (on this branch)

$ go install github.com/minamijoyo/tfupdate@fix-go-install
go: downloading github.com/minamijoyo/tfupdate v0.6.5-0.20220324012342-3e9b7ed50a5b

$ tfupdate -v
0.6.4