{"id":42062,"date":"2024-12-01T09:54:22","date_gmt":"2024-12-01T01:54:22","guid":{"rendered":"https:\/\/fwq.ai\/blog\/42062\/"},"modified":"2024-12-01T09:54:22","modified_gmt":"2024-12-01T01:54:22","slug":"go-dep-%e4%b8%8e%e4%be%9b%e5%ba%94%e5%95%86%e5%90%8c%e6%ad%a5-gopkg-toml","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/42062\/","title":{"rendered":"Go Dep &#8211; \u4e0e\u4f9b\u5e94\u5546\u540c\u6b65 Gopkg.toml"},"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>Go Dep &#8211; \u4e0e\u4f9b\u5e94\u5546\u540c\u6b65 Gopkg.toml<\/span><\/p>\n<h1>Go Dep &#8211; \u4e0e\u4f9b\u5e94\u5546\u540c\u6b65 Gopkg.toml<\/h1>\n<p><span>\u6765\u6e90\uff1astackoverflow<\/span><br \/>\n<span>2024-04-22 14:45:20<\/span><br \/>\n<span><i><\/i>0\u6d4f\u89c8<\/span><br \/>\n<span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span> <\/p>\n<p>\u4ece\u73b0\u5728\u5f00\u59cb\uff0c\u52aa\u529b\u5b66\u4e60\u5427\uff01\u672c\u6587<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300aGo Dep &#8211; \u4e0e\u4f9b\u5e94\u5546\u540c\u6b65 Gopkg.toml\u300b<\/span>\u4e3b\u8981\u8bb2\u89e3\u4e86<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\u76f8\u5173\u77e5\u8bc6\u70b9\uff0c\u6211\u4f1a\u5728\u7c73\u4e91\u4e2d\u6301\u7eed\u66f4\u65b0\u76f8\u5173\u7684\u7cfb\u5217\u6587\u7ae0\uff0c\u6b22\u8fce\u5927\u5bb6\u5173\u6ce8\u5e76\u79ef\u6781\u7559\u8a00\u5efa\u8bae\u3002\u4e0b\u9762\u5c31\u5148\u4e00\u8d77\u6765\u770b\u4e00\u4e0b\u672c\u7bc7\u6b63\u6587\u5185\u5bb9\u5427\uff0c\u5e0c\u671b\u80fd\u5e2e\u5230\u4f60\uff01<\/p>\n<p> \u95ee\u9898\u5185\u5bb9<br \/>\n <\/p>\n<p>\u6709\u6ca1\u6709\u529e\u6cd5\u521b\u5efa <code>Gokpkg.toml<\/code> \u6216\u4e0e\u6211\u5728 <code>.go<\/code> \u6587\u4ef6\u4e2d\u5bfc\u5165\u7684\u5305\u540c\u6b65\uff1f \u5982\u679c\u6211\u7684 <code>Gopkg.toml<\/code> \u4e3a\u7a7a\u5e76\u4e14\u6211\u8fd0\u884c <code>dep Ensure<\/code>\uff0c\u5b83\u4f1a\u5c06\u6211\u5728\u4ee3\u7801\u4e2d\u5bfc\u5165\u7684\u6240\u6709\u5305\u4e0b\u8f7d\u5230 <code>vendor<\/code> \u6587\u4ef6\u5939\uff0c\u4f46\u4e0d\u4f1a\u66f4\u65b0 <code>Gopkg.toml<\/code> \u6587\u4ef6\u3002 \u5f53\u6211\u5fc5\u987b\u5c06\u4e00\u4e2a\u4e0d\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u7684\u65e7\u9879\u76ee\u8fc1\u79fb\u5230\u4ee5\u6700\u7b80\u5355\u7684\u65b9\u5f0f\u4f7f\u7528 <code>dep<\/code> \u65f6\uff0c\u5c31\u51fa\u73b0\u4e86\u8fd9\u4e2a\u95ee\u9898\uff0c\u53ea\u9700\u521b\u5efa\u4e00\u4e2a <code>Gopkg.toml<\/code> \uff0c\u5176\u4e2d\u5305\u542b\u6211\u5df2\u7ecf\u5bfc\u5165\u7684\u6240\u6709\u5305\u7684\u6700\u65b0\u7248\u672c\u800c\u4e0d\u662f\u8fd0\u884c<code>dep \u786e\u4fdd\u4e3a\u6bcf\u4e2a\u5305\u624b\u52a8\u6dfb\u52a0 ...<\/code> \u3002 \u6709\u8fd9\u6837\u7684\u547d\u4ee4\u5417\uff1f<\/p>\n<p> <\/p>\n<h2>\u89e3\u51b3\u65b9\u6848<\/h2>\n<p> <\/p>\n<p>\u5220\u9664 <code>Gopkg.toml<\/code> \u6587\u4ef6\uff0c\u7136\u540e\u8fd0\u884c \u200b\u200b<code>dep init<\/code> \u548c <code>dep Ensure<\/code>\u3002\u5b83\u5c06\u521b\u5efa\u60a8\u7684 <code>Gopkg.toml<\/code> \u6587\u4ef6\u5e76\u81ea\u52a8\u8bbe\u7f6e\u6240\u6709\u4f9d\u8d56\u9879\u3002<\/p>\n<p>\u672c\u7bc7\u5173\u4e8e\u300aGo Dep &#8211; \u4e0e\u4f9b\u5e94\u5546\u540c\u6b65 Gopkg.toml\u300b\u7684\u4ecb\u7ecd\u5c31\u5230\u6b64\u7ed3\u675f\u5566\uff0c\u4f46\u662f\u5b66\u65e0\u6b62\u5883\uff0c\u60f3\u8981\u4e86\u89e3\u5b66\u4e60\u66f4\u591a\u5173\u4e8eGolang\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u524d\u4f4d\u7f6e\uff1a &gt; &gt; &gt; &gt; Go Dep &#8211; \u4e0e\u4f9b\u5e94\u5546\u540c\u6b65 Gopkg.toml Go Dep &#8211; \u4e0e\u4f9b\u5e94\u5546\u540c\u6b65 Gopkg.toml \u6765\u6e90\uff1astackoverflow 2024-04-22 14:45:20 0\u6d4f\u89c8 \u6536\u85cf \u4ece\u73b0\u5728\u5f00\u59cb\uff0c\u52aa\u529b\u5b66\u4e60\u5427\uff01\u672c\u6587\u300aGo Dep &#8211; \u4e0e\u4f9b\u5e94\u5546\u540c\u6b65 Gopkg.toml\u300b\u4e3b\u8981\u8bb2\u89e3\u4e86\u7b49\u7b49\u76f8\u5173\u77e5\u8bc6\u70b9\uff0c\u6211\u4f1a\u5728\u7c73\u4e91\u4e2d\u6301\u7eed\u66f4\u65b0\u76f8\u5173\u7684\u7cfb\u5217\u6587\u7ae0\uff0c\u6b22\u8fce\u5927\u5bb6\u5173\u6ce8\u5e76\u79ef\u6781\u7559\u8a00\u5efa\u8bae\u3002\u4e0b\u9762\u5c31\u5148\u4e00\u8d77\u6765\u770b\u4e00\u4e0b\u672c\u7bc7\u6b63\u6587\u5185\u5bb9\u5427\uff0c\u5e0c\u671b\u80fd\u5e2e\u5230\u4f60\uff01 \u95ee\u9898\u5185\u5bb9 \u6709\u6ca1\u6709\u529e\u6cd5\u521b\u5efa Gokpkg.toml \u6216\u4e0e\u6211\u5728 .go \u6587\u4ef6\u4e2d\u5bfc\u5165\u7684\u5305\u540c\u6b65\uff1f \u5982\u679c\u6211\u7684 Gopkg.toml \u4e3a\u7a7a\u5e76\u4e14\u6211\u8fd0\u884c dep Ensure\uff0c\u5b83\u4f1a\u5c06\u6211\u5728\u4ee3\u7801\u4e2d\u5bfc\u5165\u7684\u6240\u6709\u5305\u4e0b\u8f7d\u5230 vendor \u6587\u4ef6\u5939\uff0c\u4f46\u4e0d\u4f1a\u66f4\u65b0 Gopkg.toml \u6587\u4ef6\u3002 \u5f53\u6211\u5fc5\u987b\u5c06\u4e00\u4e2a\u4e0d\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u7684\u65e7\u9879\u76ee\u8fc1\u79fb\u5230\u4ee5\u6700\u7b80\u5355\u7684\u65b9\u5f0f\u4f7f\u7528 dep \u65f6\uff0c\u5c31\u51fa\u73b0\u4e86\u8fd9\u4e2a\u95ee\u9898\uff0c\u53ea\u9700\u521b\u5efa\u4e00\u4e2a Gopkg.toml \uff0c\u5176\u4e2d\u5305\u542b\u6211\u5df2\u7ecf\u5bfc\u5165\u7684\u6240\u6709\u5305\u7684\u6700\u65b0\u7248\u672c\u800c\u4e0d\u662f\u8fd0\u884cdep \u786e\u4fdd\u4e3a\u6bcf\u4e2a\u5305\u624b\u52a8\u6dfb\u52a0 &#8230; \u3002 \u6709\u8fd9\u6837\u7684\u547d\u4ee4\u5417\uff1f \u89e3\u51b3\u65b9\u6848 \u5220\u9664 Gopkg.toml \u6587\u4ef6\uff0c\u7136\u540e\u8fd0\u884c \u200b\u200bdep init [&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-42062","post","type-post","status-publish","format-standard","hentry","category-docker"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/42062","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=42062"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/42062\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=42062"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=42062"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=42062"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}