{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/26397","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/26397/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/26397/comments","events_url":"https://api.github.com/repos/golang/go/issues/26397/events","html_url":"https://github.com/golang/go/issues/26397","id":341519880,"node_id":"MDU6SXNzdWUzNDE1MTk4ODA=","number":26397,"title":"Proposal: allow go-getting specific gofmt versions","user":{"login":"mvdan","id":3576549,"node_id":"MDQ6VXNlcjM1NzY1NDk=","avatar_url":"https://avatars0.githubusercontent.com/u/3576549?v=4","gravatar_id":"","url":"https://api.github.com/users/mvdan","html_url":"https://github.com/mvdan","followers_url":"https://api.github.com/users/mvdan/followers","following_url":"https://api.github.com/users/mvdan/following{/other_user}","gists_url":"https://api.github.com/users/mvdan/gists{/gist_id}","starred_url":"https://api.github.com/users/mvdan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvdan/subscriptions","organizations_url":"https://api.github.com/users/mvdan/orgs","repos_url":"https://api.github.com/users/mvdan/repos","events_url":"https://api.github.com/users/mvdan/events{/privacy}","received_events_url":"https://api.github.com/users/mvdan/received_events","type":"User","site_admin":false},"labels":[{"id":236419512,"node_id":"MDU6TGFiZWwyMzY0MTk1MTI=","url":"https://api.github.com/repos/golang/go/labels/Proposal","name":"Proposal","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/30","html_url":"https://github.com/golang/go/milestone/30","labels_url":"https://api.github.com/repos/golang/go/milestones/30/labels","id":1373555,"node_id":"MDk6TWlsZXN0b25lMTM3MzU1NQ==","number":30,"title":"Proposal","description":"Proposals that are pending (not yet accepted/rejected).\r\n","creator":{"login":"rsc","id":104030,"node_id":"MDQ6VXNlcjEwNDAzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/104030?v=4","gravatar_id":"","url":"https://api.github.com/users/rsc","html_url":"https://github.com/rsc","followers_url":"https://api.github.com/users/rsc/followers","following_url":"https://api.github.com/users/rsc/following{/other_user}","gists_url":"https://api.github.com/users/rsc/gists{/gist_id}","starred_url":"https://api.github.com/users/rsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsc/subscriptions","organizations_url":"https://api.github.com/users/rsc/orgs","repos_url":"https://api.github.com/users/rsc/repos","events_url":"https://api.github.com/users/rsc/events{/privacy}","received_events_url":"https://api.github.com/users/rsc/received_events","type":"User","site_admin":false},"open_issues":212,"closed_issues":549,"state":"open","created_at":"2015-10-24T01:40:49Z","updated_at":"2018-07-16T13:30:48Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2018-07-16T13:30:45Z","updated_at":"2018-07-16T20:08:23Z","closed_at":null,"author_association":"MEMBER","body":"It is well understood that users shouldn't enforce Go source code formatting\r\nwith `go/format`. This is documented in its godoc, but also repeated in Go\r\nrelease notes: https://tip.golang.org/doc/go1.10#gofmt\r\n\r\nThe reason is simple - the formatting that the package produces depends on the\r\nGo version in use, so different developers may have different versions of it.\r\n\r\nWhen a project wants to enforce gofmt, what they should instead do is\r\nconsistently run a specific version of the gofmt binary.\r\n\r\nHowever, it can be difficult for many systems and developers to run exactly the\r\nsame Go version. Some people may be on an older Go version, some others may run\r\nthe beta, and some environments may be stuck on older versions of Go.\r\n\r\nCurrently, it isn't easy for those people to download a specific version of\r\ngofmt if they don't have it already. With #23223 implemented they could run `go\r\nget golang.org/v/go1.10`, but that would install much more than just `gofmt`.\r\n\r\nThis proposal suggests to add a similar mechanism to install a specific version\r\nof `gofmt`. Ideally via a simple command like `go get golang.org/v/gofmt1.10`,\r\nbut a download link would also be an improvement.\r\n\r\nThen, one could write a pre-commit hook to enforce `gofmt` from Go 1.10 as\r\nfollows:\r\n\r\n        gofmt=\"gofmt\"\r\n        if [[ $(go version) != *go1.10* ]]; then\r\n                go get golang.org/v/gofmt1.10\r\n                gofmt=\"gofmt1.10\"\r\n        fi\r\n        # use $gofmt\r\n        $gofmt -l -w ./...\r\n\r\n/cc @thaJeztah"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/405365562","html_url":"https://github.com/golang/go/issues/26397#issuecomment-405365562","issue_url":"https://api.github.com/repos/golang/go/issues/26397","id":405365562,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNTM2NTU2Mg==","user":{"login":"bradfitz","id":2621,"node_id":"MDQ6VXNlcjI2MjE=","avatar_url":"https://avatars1.githubusercontent.com/u/2621?v=4","gravatar_id":"","url":"https://api.github.com/users/bradfitz","html_url":"https://github.com/bradfitz","followers_url":"https://api.github.com/users/bradfitz/followers","following_url":"https://api.github.com/users/bradfitz/following{/other_user}","gists_url":"https://api.github.com/users/bradfitz/gists{/gist_id}","starred_url":"https://api.github.com/users/bradfitz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradfitz/subscriptions","organizations_url":"https://api.github.com/users/bradfitz/orgs","repos_url":"https://api.github.com/users/bradfitz/repos","events_url":"https://api.github.com/users/bradfitz/events{/privacy}","received_events_url":"https://api.github.com/users/bradfitz/received_events","type":"User","site_admin":false},"created_at":"2018-07-16T20:08:23Z","updated_at":"2018-07-16T20:08:23Z","author_association":"MEMBER","body":"This is slightly possible already:\r\n\r\n```\r\nbradfitz@gdev:~/go/src$ go1.8.4 download\r\nDownloaded 0.0% (23422 / 99071672 bytes) ...\r\nDownloaded 59.3% (58753024 / 99071672 bytes) ...\r\nDownloaded 100.0% (99071672 / 99071672 bytes)\r\nUnpacking /home/bradfitz/sdk/go1.8.4/go1.8.4.linux-amd64.tar.gz ...\r\nSuccess. You may now run 'go1.8.4'\r\n\r\nbradfitz@gdev:~/go/src$ go1.8.4 version\r\ngo version go1.8.4 linux/amd64\r\n\r\nbradfitz@gdev:~/go/src$ ~/sdk/go1.8.4/bin/gofmt -h\r\nusage: gofmt [flags] [path ...]\r\n  -cpuprofile string\r\n        write cpu profile to this file\r\n  -d    display diffs instead of rewriting files\r\n  -e    report all errors (not just the first 10 on different lines)\r\n  -l    list files whose formatting differs from gofmt's\r\n  -r string\r\n        rewrite rule (e.g., 'a[b:len(a)] -> a[b:]')\r\n  -s    simplify code\r\n  -w    write result to (source) file instead of stdout\r\n```\r\n"}}
{"actor":{"display_login":"bradfitz"}}