{"id":42664,"date":"2024-12-01T12:54:50","date_gmt":"2024-12-01T04:54:50","guid":{"rendered":"https:\/\/fwq.ai\/blog\/42664\/"},"modified":"2024-12-01T12:54:50","modified_gmt":"2024-12-01T04:54:50","slug":"%e5%a6%82%e4%bd%95%e4%bf%ae%e5%a4%8dgo-1-11%e6%a8%a1%e5%9d%97%e6%9c%aa%e7%9f%a5%e5%af%bc%e5%85%a5%e8%b7%af%e5%be%84%ef%bc%8c%e6%89%be%e4%b8%8d%e5%88%b0%e6%8f%90%e4%be%9b%e5%8c%85%e7%9a%84%e6%a8%a1","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/42664\/","title":{"rendered":"\u5982\u4f55\u4fee\u590dGo 1.11\u6a21\u5757\u672a\u77e5\u5bfc\u5165\u8def\u5f84\uff0c\u627e\u4e0d\u5230\u63d0\u4f9b\u5305\u7684\u6a21\u5757\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<p>\u5f53\u524d\u4f4d\u7f6e\uff1a <span>&gt;<\/span>  <span>&gt;<\/span>  <span>&gt;<\/span>  <span>&gt;<\/span> <span>\u5982\u4f55\u4fee\u590dGo 1.11\u6a21\u5757\u672a\u77e5\u5bfc\u5165\u8def\u5f84\uff0c\u627e\u4e0d\u5230\u63d0\u4f9b\u5305\u7684\u6a21\u5757\uff1f<\/span><\/p>\n<h1>\u5982\u4f55\u4fee\u590dGo 1.11\u6a21\u5757\u672a\u77e5\u5bfc\u5165\u8def\u5f84\uff0c\u627e\u4e0d\u5230\u63d0\u4f9b\u5305\u7684\u6a21\u5757\uff1f<\/h1>\n<p><span>\u6765\u6e90\uff1astackoverflow<\/span><br \/>\n<span>2024-04-25 08:15:33<\/span><br \/>\n<span><i><\/i>0\u6d4f\u89c8<\/span><br \/>\n<span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span> <\/p>\n<p>\u7c73\u4e91\u4eca\u5929\u5c06\u7ed9\u5927\u5bb6\u5e26\u6765<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300a\u5982\u4f55\u4fee\u590dGo 1.11\u6a21\u5757\u672a\u77e5\u5bfc\u5165\u8def\u5f84\uff0c\u627e\u4e0d\u5230\u63d0\u4f9b\u5305\u7684\u6a21\u5757\uff1f\u300b<\/span>\uff0c\u611f\u5174\u8da3\u7684\u670b\u53cb\u8bf7\u7ee7\u7eed\u770b\u4e0b\u53bb\u5427\uff01\u4ee5\u4e0b\u5185\u5bb9\u5c06\u4f1a\u6d89\u53ca\u5230<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\u77e5\u8bc6\u70b9\uff0c\u5982\u679c\u4f60\u662f\u6b63\u5728\u5b66\u4e60<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">Golang<\/span>\u6216\u8005\u5df2\u7ecf\u662f\u5927\u4f6c\u7ea7\u522b\u4e86\uff0c\u90fd\u975e\u5e38\u6b22\u8fce\u4e5f\u5e0c\u671b\u5927\u5bb6\u90fd\u80fd\u7ed9\u6211\u5efa\u8bae\u8bc4\u8bba\u54c8~\u5e0c\u671b\u80fd\u5e2e\u52a9\u5230\u5927\u5bb6\uff01<\/p>\n<p> \u95ee\u9898\u5185\u5bb9<br \/>\n <\/p>\n<p>\u6211\u6b63\u5728\u6784\u5efa go 1.11 \u6807\u51c6 app engine \u670d\u52a1\u3002<\/p>\n<p>\u5b83\u4e0d\u5728 <code>gopath<\/code> \u4e0b\uff0c\u6240\u4ee5\u6211\u8fd0\u884c\u4e86 <code>go mod init<\/code> \u548c <code>go mod tidy<\/code>\u3002<\/p>\n<p>\u6211\u80fd\u591f\u4f7f\u7528 <code>go build<\/code> \u6784\u5efa\u4e00\u4e2a\u7b80\u5355\u7684 web \u670d\u52a1\uff0c\u5e76\u4f7f\u7528 <code>gcloud \u5e94\u7528deploy<\/code> \u8fdb\u884c\u90e8\u7f72\u548c\u6d4b\u8bd5\u3002<\/p>\n<p>\u6211\u73b0\u5728\u5c1d\u8bd5\u6309\u7167\u6b64\u4ee3\u7801\u793a\u4f8b\u5c06 gpubsub \u4ee3\u7801\u6dfb\u52a0\u5230\u6211\u7684\u670d\u52a1\u4e2d\u3002<\/p>\n<p>\u8fd9\u4f1a\u6dfb\u52a0\u4ee5\u4e0b\u5bfc\u5165\uff1a<code>\"context\"<\/code>\u3001<code>\"cloud.google.com\/go\/pubsub\"<\/code>\u3002<\/p>\n<p>\u5f53\u6211\u8fd0\u884c <code>go build<\/code> \u65f6\uff0c\u6211\u5f97\u5230\uff1a<\/p>\n<pre>..\/..\/..\/..\/go\/pkg\/mod\/golang.org\/x\/[email&nbsp;protected]\/idna\/idna.go:23:2: unknown import path \"golang.org\/x\/text\/secure\/bidirule\": cannot find module providing package golang.org\/x\/text\/secure\/bidirule\n..\/..\/..\/..\/go\/pkg\/mod\/golang.org\/x\/[email&nbsp;protected]\/idna\/idna.go:24:2: unknown import path \"golang.org\/x\/text\/unicode\/bidi\": cannot find module providing package golang.org\/x\/text\/unicode\/bidi\n..\/..\/..\/..\/go\/pkg\/mod\/golang.org\/x\/[email&nbsp;protected]\/idna\/idna.go:25:2: unknown import path \"golang.org\/x\/text\/unicode\/norm\": cannot find module providing package golang.org\/x\/text\/unicode\/norm<\/pre>\n<p>\u5f53\u6211\u8fd0\u884c <code>go get -u all<\/code> \u65f6\uff0c\u6211\u6536\u5230\u201cno go files in\u201d<\/p>\n<pre>go build golang.org\/x\/text\/secure\/bidirule: no go files in\ngo build golang.org\/x\/text\/unicode\/bidi: no go files in\ngo build golang.org\/x\/text\/unicode\/norm: no go files in<\/pre>\n<p><code>cat go.mod<\/code> \u663e\u793a\u4ee5\u4e0b\u5185\u5bb9\uff1a &#8220;&#8220;<\/p>\n<pre>module github.com\/xxx\/yyy\n\nrequire (\n    cloud.google.com\/go v0.34.0\n    github.com\/googleapis\/gax-go v2.0.2+incompatible \/\/ indirect\n    go.opencensus.io v0.18.0 \/\/ indirect\n    golang.org\/x\/net v0.0.0-20181217023233-e147a9138326 \/\/ indirect\n    golang.org\/x\/oauth2 v0.0.0-20181203162652-d668ce993890 \/\/ indirect\n    golang.org\/x\/sync v0.0.0-20181108010431-42b317875d0f \/\/ indirect\n    golang.org\/x\/sys v0.0.0-20181218192612-074acd46bca6 \/\/ indirect\n    google.golang.org\/api v0.0.0-20181220000619-583d854617af \/\/ indirect\n    google.golang.org\/appengine v1.3.0 \/\/ indirect\n    google.golang.org\/genproto v0.0.0-20181219182458-5a97ab628bfb \/\/ indirect\n    google.golang.org\/grpc v1.17.0 \/\/ indirect\n)<\/pre>\n<p>&#8220;`<\/p>\n<p><code>go list .<\/code> \u663e\u793a\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<pre>go: finding golang.org\/x\/text\/unicode\/bidi latest\ngo: finding golang.org\/x\/text\/secure\/bidirule latest\ngo: finding golang.org\/x\/text\/unicode\/norm latest\ngo: finding golang.org\/x\/text\/unicode latest\ngo: finding golang.org\/x\/text\/secure latest\ngithub.com\/XXX\/YYY\/ZZZ (our project)<\/pre>\n<p>\u8fd9\u4f3c\u4e4e\u662f\u4e00\u4e9b\u6682\u65f6\u7684\u4f9d\u8d56\u3002<\/p>\n<p>\u5f53\u6211\u4f7f\u7528 <code>gcloud \u5e94\u7528\u90e8\u7f72 <\/code> \u8fdb\u884c\u90e8\u7f72\u65f6\uff0c\u6211\u7684\u670d\u52a1<em>\u786e\u5b9e<\/em>\u6210\u529f\u6784\u5efa\u5e76\u5728\u6267\u884c\u65f6\u53d1\u5e03\u5230 pubsub \u4e3b\u9898\uff0c\u56e0\u6b64\u8fd9\u662f\u4e00\u4e2a\u672c\u5730\u95ee\u9898\u3002<\/p>\n<p>\u5982\u4f55\u8bca\u65ad\u5e76\u4fee\u590d\u6b64\u672c\u5730\u5f00\u53d1\u73af\u5883\u95ee\u9898\uff1f<\/p>\n<p> <\/p>\n<h2>\u89e3\u51b3\u65b9\u6848<\/h2>\n<p> <\/p>\n<p>\u5df2\u4fee\u590d\uff1a<\/p>\n<p><code>rm -rf ~\/go\/pkg\/mod\/golang.org\/x\/<\/code><\/p>\n<p><code>go \u83b7\u53d6 golang.org\/x\/text<\/code><\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u672c\u6587\u7684\u5168\u90e8\u5185\u5bb9\u4e86\uff0c\u662f\u5426\u6709\u987a\u5229\u5e2e\u52a9\u4f60\u89e3\u51b3\u95ee\u9898\uff1f\u82e5\u662f\u80fd\u7ed9\u4f60\u5e26\u6765\u5b66\u4e60\u4e0a\u7684\u5e2e\u52a9\uff0c\u8bf7\u5927\u5bb6\u591a\u591a\u652f\u6301\u7c73\u4e91\uff01\u66f4\u591a\u5173\u4e8eGolang\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u4e5f\u53ef\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u524d\u4f4d\u7f6e\uff1a &gt; &gt; &gt; &gt; \u5982\u4f55\u4fee\u590dGo 1.11\u6a21\u5757\u672a\u77e5\u5bfc\u5165\u8def\u5f84\uff0c\u627e\u4e0d\u5230\u63d0\u4f9b\u5305\u7684\u6a21\u5757\uff1f \u5982\u4f55\u4fee\u590dGo 1.11\u6a21\u5757\u672a\u77e5\u5bfc\u5165\u8def\u5f84\uff0c\u627e\u4e0d\u5230\u63d0\u4f9b\u5305\u7684\u6a21\u5757\uff1f \u6765\u6e90\uff1astackoverflow 2024-04-25 08:15:33 0\u6d4f\u89c8 \u6536\u85cf \u7c73\u4e91\u4eca\u5929\u5c06\u7ed9\u5927\u5bb6\u5e26\u6765\u300a\u5982\u4f55\u4fee\u590dGo 1.11\u6a21\u5757\u672a\u77e5\u5bfc\u5165\u8def\u5f84\uff0c\u627e\u4e0d\u5230\u63d0\u4f9b\u5305\u7684\u6a21\u5757\uff1f\u300b\uff0c\u611f\u5174\u8da3\u7684\u670b\u53cb\u8bf7\u7ee7\u7eed\u770b\u4e0b\u53bb\u5427\uff01\u4ee5\u4e0b\u5185\u5bb9\u5c06\u4f1a\u6d89\u53ca\u5230\u7b49\u7b49\u77e5\u8bc6\u70b9\uff0c\u5982\u679c\u4f60\u662f\u6b63\u5728\u5b66\u4e60Golang\u6216\u8005\u5df2\u7ecf\u662f\u5927\u4f6c\u7ea7\u522b\u4e86\uff0c\u90fd\u975e\u5e38\u6b22\u8fce\u4e5f\u5e0c\u671b\u5927\u5bb6\u90fd\u80fd\u7ed9\u6211\u5efa\u8bae\u8bc4\u8bba\u54c8~\u5e0c\u671b\u80fd\u5e2e\u52a9\u5230\u5927\u5bb6\uff01 \u95ee\u9898\u5185\u5bb9 \u6211\u6b63\u5728\u6784\u5efa go 1.11 \u6807\u51c6 app engine \u670d\u52a1\u3002 \u5b83\u4e0d\u5728 gopath \u4e0b\uff0c\u6240\u4ee5\u6211\u8fd0\u884c\u4e86 go mod init \u548c go mod tidy\u3002 \u6211\u80fd\u591f\u4f7f\u7528 go build \u6784\u5efa\u4e00\u4e2a\u7b80\u5355\u7684 web \u670d\u52a1\uff0c\u5e76\u4f7f\u7528 gcloud \u5e94\u7528deploy \u8fdb\u884c\u90e8\u7f72\u548c\u6d4b\u8bd5\u3002 \u6211\u73b0\u5728\u5c1d\u8bd5\u6309\u7167\u6b64\u4ee3\u7801\u793a\u4f8b\u5c06 gpubsub \u4ee3\u7801\u6dfb\u52a0\u5230\u6211\u7684\u670d\u52a1\u4e2d\u3002 \u8fd9\u4f1a\u6dfb\u52a0\u4ee5\u4e0b\u5bfc\u5165\uff1a&#8221;context&#8221;\u3001&#8221;cloud.google.com\/go\/pubsub&#8221;\u3002 \u5f53\u6211\u8fd0\u884c go build \u65f6\uff0c\u6211\u5f97\u5230\uff1a ..\/..\/..\/..\/go\/pkg\/mod\/golang.org\/x\/[email&nbsp;protected]\/idna\/idna.go:23:2: unknown import path [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-42664","post","type-post","status-publish","format-standard","hentry","category-docker"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/42664","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=42664"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/42664\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=42664"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=42664"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=42664"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}