{"thread":{"id":"55413","subject":"[PATCH] persistent-https: add go.mod to fix compile","startedAt":"2021-03-30T13:08:26Z","lastAt":"2021-03-30T22:58:50Z","messageCount":6,"participants":["Dominyk Tiller via GitGitGadget","Junio C Hamano","Dominyk Tiller","Eric Sunshine"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"420576","messageId":"pull.989.git.git.1617109668438.gitgitgadget@gmail.com","threadId":"55413","inReplyTo":null,"subject":"[PATCH] persistent-https: add go.mod to fix compile","fromName":"Dominyk Tiller via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2021-03-30T13:07:48Z","receivedAt":"2021-03-30T13:08:26Z","isPatch":true,"sender":{"key":"dominyktiller@gmail.com","avatar":null},"body":"From: Dominyk Tiller <dominyktiller@gmail.com>\n\nGOPATH-based builds and non module-aware builds are being deprecated\nby golang upstream, which currently causes this to fail. This adds a\nbarebones mod file to fix the build.\n\nThe `persistent-https` code hasn't been touched for a long time but\nI assume this is preferable to simply removing it from the codebase.\n\nBefore this change:\n```\ncase $(go version) in \\\n\t\"go version go\"1.[0-5].*) EQ=\" \" ;; *) EQ=\"=\" ;; esac && \\\n\tgo build -o git-remote-persistent-https \\\n\t\t-ldflags \"-X main._BUILD_EMBED_LABEL${EQ}\"\ngo: cannot find main module, but found .git/config in ../git\n\tto create a module there, run:\n\tcd ../.. && go mod init\nmake: *** [git-remote-persistent-https] Error 1\n```\n\nRef: https://blog.golang.org/go116-module-changes.\n\nSigned-off-by: Dominyk Tiller <dominyktiller@gmail.com>\n---\n    persistent-https: add go.mod to fix compile\n    \n    GOPATH-based builds and non module-aware builds are being deprecated by\n    golang upstream, which currently causes this to fail. This adds a\n    barebones mod file to fix the build.\n    \n    The persistent-https code hasn't been touched for a long time but I\n    assume this is preferable to simply removing it from the codebase.\n    Before this change:\n    \n    case $(go version) in \\\n        \"go version go\"1.[0-5].*) EQ=\" \" ;; *) EQ=\"=\" ;; esac && \\\n        go build -o git-remote-persistent-https \\\n            -ldflags \"-X main._BUILD_EMBED_LABEL${EQ}\"\n    go: cannot find main module, but found .git/config in ../git\n        to create a module there, run:\n        cd ../.. && go mod init\n    make: *** [git-remote-persistent-https] Error 1\n    \n    \n    Ref: https://blog.golang.org/go116-module-changes\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-989%2FDomT4%2Fgo_modules-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-989/DomT4/go_modules-v1\nPull-Request: https://github.com/git/git/pull/989\n\n contrib/persistent-https/go.mod | 3 +++\n 1 file changed, 3 insertions(+)\n create mode 100644 contrib/persistent-https/go.mod\n\ndiff --git a/contrib/persistent-https/go.mod b/contrib/persistent-https/go.mod\nnew file mode 100644\nindex 000000000000..6028b1fe5e62\n--- /dev/null\n+++ b/contrib/persistent-https/go.mod\n@@ -0,0 +1,3 @@\n+module github.com/git/git/contrib/persistent-https\n+\n+go 1.16\n\nbase-commit: 9198c13e34f6d51c983b31a9397d4d62bc2147ac\n-- \ngitgitgadget\n"},{"id":"420642","messageId":"xmqqy2e4cvbl.fsf@gitster.g","threadId":"55413","inReplyTo":"pull.989.git.git.1617109668438.gitgitgadget@gmail.com","subject":"Re: [PATCH] persistent-https: add go.mod to fix compile","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-03-30T19:09:34Z","receivedAt":"2021-03-30T19:10:26Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Dominyk Tiller via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: Dominyk Tiller <dominyktiller@gmail.com>\n>\n> GOPATH-based builds and non module-aware builds are being deprecated\n> by golang upstream, which currently causes this to fail. This adds a\n> barebones mod file to fix the build.\n>\n> The `persistent-https` code hasn't been touched for a long time but\n> I assume this is preferable to simply removing it from the codebase.\n>\n> Before this change:\n> ```\n> case $(go version) in \\\n> \t\"go version go\"1.[0-5].*) EQ=\" \" ;; *) EQ=\"=\" ;; esac && \\\n> \tgo build -o git-remote-persistent-https \\\n> \t\t-ldflags \"-X main._BUILD_EMBED_LABEL${EQ}\"\n> go: cannot find main module, but found .git/config in ../git\n> \tto create a module there, run:\n> \tcd ../.. && go mod init\n> make: *** [git-remote-persistent-https] Error 1\n> ```\n\nWith which version of go?  Any recent version would fail the same\nway, or only 1.16 and later?\n\n> Ref: https://blog.golang.org/go116-module-changes.\n\n> diff --git a/contrib/persistent-https/go.mod b/contrib/persistent-https/go.mod\n> new file mode 100644\n> index 000000000000..6028b1fe5e62\n> --- /dev/null\n> +++ b/contrib/persistent-https/go.mod\n> @@ -0,0 +1,3 @@\n> +module github.com/git/git/contrib/persistent-https\n> +\n> +go 1.16\n\nCan I ask what is affected by this 1.16 version number?  Do the\nusers have to use 1.16 and nothing older or newer?\n\nAs a non Go user, I am trying to see if this change is \"make it work\nfor all users of reasonably new versions of Go\" (if that is the\ncase, what is the \"reasonably new\") or \"make it work for those with\n1.16, and everybody else should either install 1.16 or figure out \ntheir own solutions\".\n\nThanks.\n"},{"id":"420654","messageId":"3dd5a0cd-94cc-e7ec-b1b1-feb39c65e85d@gmail.com","threadId":"55413","inReplyTo":"xmqqy2e4cvbl.fsf@gitster.g","subject":"Re: [PATCH] persistent-https: add go.mod to fix compile","fromName":"Dominyk Tiller","fromEmail":"dominyktiller@gmail.com","sentAt":"2021-03-30T21:30:26Z","receivedAt":"2021-03-30T21:32:13Z","isPatch":true,"sender":{"key":"dominyktiller@gmail.com","avatar":null},"body":"Junio C Hamano wrote on 30/03/2021 20:09:\n> \"Dominyk Tiller via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n>\n>> From: Dominyk Tiller <dominyktiller@gmail.com>\n>>\n>> GOPATH-based builds and non module-aware builds are being deprecated\n>> by golang upstream, which currently causes this to fail. This adds a\n>> barebones mod file to fix the build.\n>>\n>> The `persistent-https` code hasn't been touched for a long time but\n>> I assume this is preferable to simply removing it from the codebase.\n>>\n>> Before this change:\n>> ```\n>> case $(go version) in \\\n>> \t\"go version go\"1.[0-5].*) EQ=\" \" ;; *) EQ=\"=\" ;; esac && \\\n>> \tgo build -o git-remote-persistent-https \\\n>> \t\t-ldflags \"-X main._BUILD_EMBED_LABEL${EQ}\"\n>> go: cannot find main module, but found .git/config in ../git\n>> \tto create a module there, run:\n>> \tcd ../.. && go mod init\n>> make: *** [git-remote-persistent-https] Error 1\n>> ```\n> With which version of go?  Any recent version would fail the same\n> way, or only 1.16 and later?\nThe link I referenced in the notes explains a little more in depth, but\nthere's an environment variable you can use with 1.16 to temporarily\nmitigate the failure, i.e. `export GO111MODULE=off`, but regardless of\nthe presence of that the lack of module-awareness will become a hard\nfailure in Go 1.17. The lack of module awareness is only a failure on Go\n1.16 and later. Module support was added in basic form as far back as Go\n1.11, released late 2018.\n>\n>> Ref: https://blog.golang.org/go116-module-changes.\n>> diff --git a/contrib/persistent-https/go.mod b/contrib/persistent-https/go.mod\n>> new file mode 100644\n>> index 000000000000..6028b1fe5e62\n>> --- /dev/null\n>> +++ b/contrib/persistent-https/go.mod\n>> @@ -0,0 +1,3 @@\n>> +module github.com/git/git/contrib/persistent-https\n>> +\n>> +go 1.16\n> Can I ask what is affected by this 1.16 version number?  Do the\n> users have to use 1.16 and nothing older or newer?\n>\n> As a non Go user, I am trying to see if this change is \"make it work\n> for all users of reasonably new versions of Go\" (if that is the\n> case, what is the \"reasonably new\") or \"make it work for those with\n> 1.16, and everybody else should either install 1.16 or figure out \n> their own solutions\".\n>\n> Thanks.\nThis is more thoroughly detailed here:\nhttps://golang.org/ref/mod#go-mod-file-go, but essentially the version\nnumber was/is intended to be the minimum Go version the module is\ndesigned to work with. We could set it lower to play it safe if the Git\nproject wishes, but to date there have been no backwards\nincompatibilities with the module system and the way we're using the\nmodule system is so basic I don't see any way we'd trigger the\nversion-based behaviours detailed in the link above. For what it's worth\ntesting locally against 1.15 it builds without issue, despite being a\nlower version number than specified in the string.\n\nDom\n===\n\n"},{"id":"420660","messageId":"xmqq1rbwcn4a.fsf@gitster.g","threadId":"55413","inReplyTo":"3dd5a0cd-94cc-e7ec-b1b1-feb39c65e85d@gmail.com","subject":"Re: [PATCH] persistent-https: add go.mod to fix compile","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-03-30T22:06:45Z","receivedAt":"2021-03-30T22:07:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dominyk Tiller <dominyktiller@gmail.com> writes:\n\n> Junio C Hamano wrote on 30/03/2021 20:09:\n>> \"Dominyk Tiller via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n>>\n>>> From: Dominyk Tiller <dominyktiller@gmail.com>\n>>>\n>>> GOPATH-based builds and non module-aware builds are being deprecated\n>>> by golang upstream, which currently causes this to fail. This adds a\n>>> barebones mod file to fix the build.\n>>>\n>>> The `persistent-https` code hasn't been touched for a long time but\n>>> I assume this is preferable to simply removing it from the codebase.\n>>>\n>>> Before this change:\n>>> ```\n>>> case $(go version) in \\\n>>> \t\"go version go\"1.[0-5].*) EQ=\" \" ;; *) EQ=\"=\" ;; esac && \\\n>>> \tgo build -o git-remote-persistent-https \\\n>>> \t\t-ldflags \"-X main._BUILD_EMBED_LABEL${EQ}\"\n>>> go: cannot find main module, but found .git/config in ../git\n>>> \tto create a module there, run:\n>>> \tcd ../.. && go mod init\n>>> make: *** [git-remote-persistent-https] Error 1\n>>> ```\n>> With which version of go?  Any recent version would fail the same\n>> way, or only 1.16 and later?\n> The link I referenced in the notes explains a little more in depth, but\n> there's an environment variable you can use with 1.16 to temporarily\n> mitigate the failure, i.e. `export GO111MODULE=off`, but regardless of\n> the presence of that the lack of module-awareness will become a hard\n> failure in Go 1.17. The lack of module awareness is only a failure on Go\n> 1.16 and later. Module support was added in basic form as far back as Go\n> 1.11, released late 2018.\n>>\n>>> Ref: https://blog.golang.org/go116-module-changes.\n>>> diff --git a/contrib/persistent-https/go.mod b/contrib/persistent-https/go.mod\n>>> new file mode 100644\n>>> index 000000000000..6028b1fe5e62\n>>> --- /dev/null\n>>> +++ b/contrib/persistent-https/go.mod\n>>> @@ -0,0 +1,3 @@\n>>> +module github.com/git/git/contrib/persistent-https\n>>> +\n>>> +go 1.16\n>> Can I ask what is affected by this 1.16 version number?  Do the\n>> users have to use 1.16 and nothing older or newer?\n>>\n>> As a non Go user, I am trying to see if this change is \"make it work\n>> for all users of reasonably new versions of Go\" (if that is the\n>> case, what is the \"reasonably new\") or \"make it work for those with\n>> 1.16, and everybody else should either install 1.16 or figure out \n>> their own solutions\".\n>>\n>> Thanks.\n> This is more thoroughly detailed here:\n> https://golang.org/ref/mod#go-mod-file-go, but essentially the version\n> number was/is intended to be the minimum Go version the module is\n> designed to work with. We could set it lower to play it safe if the Git\n> project wishes, but to date there have been no backwards\n> incompatibilities with the module system and the way we're using the\n> module system is so basic I don't see any way we'd trigger the\n> version-based behaviours detailed in the link above. For what it's worth\n> testing locally against 1.15 it builds without issue, despite being a\n> lower version number than specified in the string.\n\nI've done the same experiment with 1.15 before writing the message\nyou are responding to.\n\nIt felt a bit of magic as I never expected 1.15 binary to anticipate\nwhat is in 1.16, or to be able to say that a version from the future\n(from 1.15 binary's point of view) has backward incompatible\nsemantics to stop the use of the module (the reason why I used 1.15\nwas because it was readily available in Debian).  Public\ndocumentation by Go folks that explain go.mod file format seems to\nuse \"go 1.12\" in the examples everywhere, so it might be a sane\nversion string to use?\n\nIn any case, explaining these things in this response is good, but\neventually we need to make sure that the readers of the resulting\ncommit would not have to ask the same question, without having to\nrefer to external documentation.\n\nThanks.\n"},{"id":"420661","messageId":"CAPig+cRmJLkkzsROuUifah2-RgSoEXmLnBDV8-a8iL3jF0CBLQ@mail.gmail.com","threadId":"55413","inReplyTo":"xmqq1rbwcn4a.fsf@gitster.g","subject":"Re: [PATCH] persistent-https: add go.mod to fix compile","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2021-03-30T22:12:54Z","receivedAt":"2021-03-30T22:14:04Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, Mar 30, 2021 at 6:07 PM Junio C Hamano <gitster@pobox.com> wrote:\n> In any case, explaining these things in this response is good, but\n> eventually we need to make sure that the readers of the resulting\n> commit would not have to ask the same question, without having to\n> refer to external documentation.\n\nIt might also be worthwhile -- for the non-Go readers -- for the\ncommit message to mention that this addition of a `go.mod` file does\nnot hinder those stuck with old pre-module versions of Go (it doesn't\nhelp them either, but that's less significant), thus this change does\nnot require them to update to a modern version of Go (i.e. we're not\nraising the minimum required version).\n"},{"id":"420663","messageId":"xmqqpmzgb66j.fsf@gitster.g","threadId":"55413","inReplyTo":"CAPig+cRmJLkkzsROuUifah2-RgSoEXmLnBDV8-a8iL3jF0CBLQ@mail.gmail.com","subject":"Re: [PATCH] persistent-https: add go.mod to fix compile","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-03-30T22:57:56Z","receivedAt":"2021-03-30T22:58:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Sunshine <sunshine@sunshineco.com> writes:\n\n> On Tue, Mar 30, 2021 at 6:07 PM Junio C Hamano <gitster@pobox.com> wrote:\n>> In any case, explaining these things in this response is good, but\n>> eventually we need to make sure that the readers of the resulting\n>> commit would not have to ask the same question, without having to\n>> refer to external documentation.\n>\n> It might also be worthwhile -- for the non-Go readers -- for the\n> commit message to mention that this addition of a `go.mod` file does\n> not hinder those stuck with old pre-module versions of Go (it doesn't\n> help them either, but that's less significant), thus this change does\n> not require them to update to a modern version of Go (i.e. we're not\n> raising the minimum required version).\n\nThanks for spelling out the most important part of what the readers\nshould be able to read from the resulting commit.  I agree that\npiece of information is a must.\n\n\n\n"}]}