{"id":2613,"date":"2022-06-19T12:57:41","date_gmt":"2022-06-19T03:57:41","guid":{"rendered":"https:\/\/blog.wsd.sh\/?p=2613"},"modified":"2022-06-19T13:07:46","modified_gmt":"2022-06-19T04:07:46","slug":"go-buildcannot-find-package","status":"publish","type":"post","link":"https:\/\/blog.wsd.sh\/?p=2613","title":{"rendered":"<small>go build:cannot find package<\/small>"},"content":{"rendered":"<p>\uff11\uff0e\u4f5c\u696d<br \/>\ngolang\u3067\u4f5c\u6210\u3057\u305fapplication\u3092CentOS 8 \u304b\u3089CentOS stream 9 \u306b\u79fb\u884c\u3059\u308b<\/p>\n<p>\uff12\uff0e\u74b0\u5883<\/p>\n<pre>\r\n# go version\r\ngo version go1.17.5 linux\/amd64\r\n\r\n# uname -a\r\nLinux localhost.localdomain 5.14.0-109.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jun 10 09:54:17 UTC 2022 x86_64 x86_64 x86_64 GNU\/Linux\r\n<\/pre>\n<p>\uff13\uff0egolang build \u6642\u306eerror<br \/>\ncannot find package<\/p>\n<p>\uff14\uff0eGO111MODULE \u3092 off \u306b\u5909\u66f4<br \/>\n<a href=\"http:\/\/GO111MODULE with Go 1.16\">https:\/\/maelvls.dev\/go111module-everywhere\/<\/a><br \/>\nif you want to keep using the old GOPATH way, you will have to force Go not to use the Go Modules feature:<br \/>\nexport GO111MODULE=off<\/p>\n<pre>\r\n# go env |grep GO111MODULE\r\nGO111MODULE=\"auto\"\r\n# go env -w  GO111MODULE=off\r\n# go env |grep GO111MODULE\r\nGO111MODULE=\"off\"\r\n<\/pre>\n<p>\uff15\uff0epakage\u306einstall<br \/>\n# go get &#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uff11\uff0e\u4f5c\u696d golang\u3067\u4f5c\u6210\u3057\u305fapplication\u3092CentOS 8 \u304b\u3089CentOS stream 9 \u306b\u79fb\u884c\u3059\u308b \uff12\uff0e\u74b0\u5883 # go version go version go1.17.5 linux\/amd64&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/posts\/2613"}],"collection":[{"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2613"}],"version-history":[{"count":7,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/posts\/2613\/revisions"}],"predecessor-version":[{"id":2620,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=\/wp\/v2\/posts\/2613\/revisions\/2620"}],"wp:attachment":[{"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2613"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2613"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.wsd.sh\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2613"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}