{"action":"opened","issue":{"url":"https://api.github.com/repos/golang/go/issues/28741","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/28741/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/28741/comments","events_url":"https://api.github.com/repos/golang/go/issues/28741/events","html_url":"https://github.com/golang/go/issues/28741","id":379885664,"node_id":"MDU6SXNzdWUzNzk4ODU2NjQ=","number":28741,"title":"proposal: add 'implements'","user":{"login":"Webern","id":6260372,"node_id":"MDQ6VXNlcjYyNjAzNzI=","avatar_url":"https://avatars2.githubusercontent.com/u/6260372?v=4","gravatar_id":"","url":"https://api.github.com/users/Webern","html_url":"https://github.com/Webern","followers_url":"https://api.github.com/users/Webern/followers","following_url":"https://api.github.com/users/Webern/following{/other_user}","gists_url":"https://api.github.com/users/Webern/gists{/gist_id}","starred_url":"https://api.github.com/users/Webern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Webern/subscriptions","organizations_url":"https://api.github.com/users/Webern/orgs","repos_url":"https://api.github.com/users/Webern/repos","events_url":"https://api.github.com/users/Webern/events{/privacy}","received_events_url":"https://api.github.com/users/Webern/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-12T17:45:26Z","updated_at":"2018-11-12T17:45:26Z","closed_at":null,"author_association":"NONE","body":"<!-- Please answer these questions before submitting your issue. Thanks! -->\r\n\r\n### What version of Go are you using (`go version`)?\r\n1.11\r\n<pre>\r\n$ go version\r\n\r\n</pre>\r\n\r\n### Does this issue reproduce with the latest release?\r\nYes.\r\n\r\n\r\n### What operating system and processor architecture are you using (`go env`)?\r\n\r\n<details><summary><code>go env</code> Output</summary><br><pre>\r\n$ go env\r\n\r\n```\r\nGOARCH=\"amd64\"\r\nGOBIN=\"\"\r\nGOCACHE=\"/Users/mjb/Library/Caches/go-build\"\r\nGOEXE=\"\"\r\nGOFLAGS=\"\"\r\nGOHOSTARCH=\"amd64\"\r\nGOHOSTOS=\"darwin\"\r\nGOOS=\"darwin\"\r\nGOPATH=\"/Users/mjb/repos/go\"\r\nGOPROXY=\"\"\r\nGORACE=\"\"\r\nGOROOT=\"/usr/local/go\"\r\nGOTMPDIR=\"\"\r\nGOTOOLDIR=\"/usr/local/go/pkg/tool/darwin_amd64\"\r\nGCCGO=\"gccgo\"\r\nCC=\"clang\"\r\nCXX=\"clang++\"\r\nCGO_ENABLED=\"1\"\r\nGOMOD=\"\"\r\nCGO_CFLAGS=\"-g -O2\"\r\nCGO_CPPFLAGS=\"\"\r\nCGO_CXXFLAGS=\"-g -O2\"\r\nCGO_FFLAGS=\"-g -O2\"\r\nCGO_LDFLAGS=\"-g -O2\"\r\nPKG_CONFIG=\"pkg-config\"\r\nGOGCCFLAGS=\"-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/rm/wb3nkcw91sl3174x90rw5n9r0000gn/T/go-build117438139=/tmp/go-build -gno-record-gcc-switches -fno-common\"\r\n```\r\n</pre></details>\r\n\r\n### What did you do?\r\n\r\nI started programming with Go about a month ago.\r\n\r\nIt is truly an awesome language. However, I think a lot of time could be saved by adding an optional hint to the compiler when I am implementing an interface. I can't see how this would break anything, and it would be totally backward compatible and optional. But it would give the compiler the ability to provide very specific and helpful information when my struct does not comply with the desired interface.\r\n\r\nExample:\r\n\r\n```\r\ntype Baz struct implements Foo, Bar {\r\n    ....\r\n}\r\n```\r\n\r\nIn this case, Baz would fail to compile if any of the signatures of Foo or Bar are missing or incorrect, and the compiler could provide very specific information about the incorrect or missing signatures, at the site of Baz.\r\n\r\nFor backwards compatibility I could omit `implements Foo, Bar`.\r\n\r\n<!--\r\nIf possible, provide a recipe for reproducing the error.\r\nA complete runnable program is good.\r\nA link on play.golang.org is best.\r\n-->\r\n\r\n\r\n\r\n### What did you expect to see?\r\n\r\nBetter information from the compiler and IDE about struct compatibility with interfaces.\r\n\r\n### What did you see instead?\r\n\r\nFailures to compile because my struct is not compatible with the desired interface, at times without helpful information about _why_ the struct is incompatible with the interface."}}
{"actor":{"display_login":"Webern"}}