wiki/packages.go.html

15 lines
7.4 KiB
HTML
Raw Normal View History

2022-07-29 15:41:17 +00:00
<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width"/><meta charSet="utf-8"/><title>Go packages</title><script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script><script id="MathJax-script" async="" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script><script type="text/x-mathjax-config">
MathJax = {
tex: {
inlineMath: [ [&#x27;$&#x27;,&#x27;$&#x27;], [&#x27;\(&#x27;,&#x27;\)&#x27;] ],
displayMath: [ [&#x27;$$&#x27;,&#x27;$$&#x27;], [&#x27;[&#x27;,&#x27;]&#x27;] ]
},
options = {
processHtmlClass = &quot;math&quot;
}
}
</script><meta name="next-head-count" content="6"/><link rel="preload" href="/wiki/_next/static/css/52fc2ba29703df73922c.css" as="style"/><link rel="stylesheet" href="/wiki/_next/static/css/52fc2ba29703df73922c.css" data-n-g=""/><noscript data-n-css=""></noscript><link rel="preload" href="/wiki/_next/static/chunks/main-ae4733327bd95c4ac325.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/webpack-50bee04d1dc61f8adf5b.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/framework.9d524150d48315f49e80.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/commons.0e1c3f9aa780c2dfe9f0.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/pages/_app-8e3d0c58a60ec788aa69.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/940643274e605e7596ecea1f2ff8d83317a3fb76.4841a16762f602a59f00.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/pages/%5B%5B...slug%5D%5D-1aa198f87ede1cd0e1dc.js" as="script"/></head><body><div id="__next"><main><h1>Go packages</h1><section class="post-metadata"><span>Date: <!-- -->2021-07-27 10:38:45 +08:00</span><span>Date modified: <!-- -->2021-07-28 10:43:39 +08:00</span></section><nav class="toc"><ol class="toc-level toc-level-1"></ol></nav><ul><li><p><a href="https://golang.org/ref/mod">reference page</a></p></li><li><p>names are traditionally URL-like (e.g., <code class="inline-verbatim">github.com/gohugoio/hugo</code>, <code class="inline-verbatim">github.com/errata-ai/vale</code>) similar to <a href="roam:Deno packages">roam:Deno packages</a></p></li><li><p>has to be explicitly set with the <code class="inline-verbatim">go.mod</code> file (i.e., <code class="inline-verbatim">module MODULE_NAME</code>)
</p></li><li><p><code class="inline-verbatim">go.sum</code> functions similarly to lockfiles containing cryptographic hashes of the modules used for a successful build
</p></li><li><p>Go modules can be vendored (e.g., <code class="inline-verbatim">go mod vendor</code>);
it will be stored in the <code class="inline-verbatim">vendor/</code> directory of the root module
</p><ul><li><p>example of a project using vendored Go modules is <a href="https://github.com/errata-ai/vale/tree/v2.5.0">Vale v2.5.0</a></p></li></ul></li></ul></main></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"metadata":{"date":"2021-07-27 10:38:45 +08:00","date_modified":"2021-07-28 10:43:39 +08:00","language":"en","source":""},"title":"Go packages","hast":{"type":"root","children":[{"type":"element","tagName":"nav","properties":{"className":"toc"},"children":[{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-1"},"children":[]}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"a","properties":{"href":"https://golang.org/ref/mod"},"children":[{"type":"text","value":"reference page"}]}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"names are traditionally URL-like (e.g., "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"github.com/gohugoio/hugo"}]},{"type":"text","value":", "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"github.com/errata-ai/vale"}]},{"type":"text","value":") similar to "},{"type":"element","tagName":"a","properties":{"href":"roam:Deno packages"},"children":[{"type":"text","value":"roam:Deno packages"}]}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"has to be explicitly set with the "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"go.mod"}]},{"type":"text","value":" file (i.e., "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"module MODULE_NAME"}]},{"type":"text","value":")\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"go.sum"}]},{"type":"text","value":" functions similarly to lockfiles containing cryptographic hashes of the modules used for a successful build\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Go modules can be vendored (e.g., "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"go mod vendor"}]},{"type":"text","value":");\n it will be stored in the "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"vendor/"}]},{"type":"text","value":" directory of the root module\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"example of a project using vendored Go modules is "},{"type":"element","tagName":"a","properties":{"href":"https://github.com/errata-ai/vale/tree/v2.5.0"},"children":[{"type":"text","value":"Vale v2.5.0"}]}]}]}]}]}]}]},"backlinks":[]},"__N_SSG":true},"page":"/[[...slug]]","query":{"slug":["packages.go"]},"buildId":"Ie9t5zutrXP6Of75Cb5xF","assetPrefix":"/wiki","nextExport":false,"isFallback":false,"gsp":true}</script><script nomodule="" src="/wiki/_next/static/chunks/polyfills-99d808df29361cf7ffb1.js"></script><script src="/wiki/_next/static/chunks/main-ae4733327bd95c4ac325.js" async=""></script><script src="/wiki/_next/static/chunks/webpack-50bee04d1dc61f8adf5b.js" async=""></script><script src="/wiki/_next/static/chunks/framework.9d524150d48315f49e80.js" async=""></script><sc