Re: [PATCH] persistent-https: add go.mod to fix compile
From: Junio C Hamano <hidden>
Date: 2021-03-30 19:10:26
"Dominyk Tiller via GitGitGadget" [off-list ref] writes:
From: Dominyk Tiller <redacted> GOPATH-based builds and non module-aware builds are being deprecated by golang upstream, which currently causes this to fail. This adds a barebones mod file to fix the build. The `persistent-https` code hasn't been touched for a long time but I assume this is preferable to simply removing it from the codebase. Before this change:case $(go version) in \ "go version go"1.[0-5].*) EQ=" " ;; *) EQ="=" ;; esac && \ go build -o git-remote-persistent-https \ -ldflags "-X main._BUILD_EMBED_LABEL${EQ}" go: cannot find main module, but found .git/config in ../git to create a module there, run: cd ../.. && go mod init make: *** [git-remote-persistent-https] Error 1
With which version of go? Any recent version would fail the same way, or only 1.16 and later?
Ref: https://blog.golang.org/go116-module-changes.
quoted hunk
diff --git a/contrib/persistent-https/go.mod b/contrib/persistent-https/go.mod new file mode 100644 index 000000000000..6028b1fe5e62 --- /dev/null +++ b/contrib/persistent-https/go.mod@@ -0,0 +1,3 @@ +module github.com/git/git/contrib/persistent-https + +go 1.16
Can I ask what is affected by this 1.16 version number? Do the users have to use 1.16 and nothing older or newer? As a non Go user, I am trying to see if this change is "make it work for all users of reasonably new versions of Go" (if that is the case, what is the "reasonably new") or "make it work for those with 1.16, and everybody else should either install 1.16 or figure out their own solutions". Thanks.