Using Go Modules
Let’s update our to import and use it to implement :
Now let’s run the test again:
The command resolves imports by using the specific dependency module versions listed in . In addition to , the command maintains a file named containing the expected cryptographic hashes of the content of specific module versions:
The command uses the file to ensure that future downloads of these modules retrieve the same bits as the first download, to ensure the modules your project depends on do not change unexpectedly, whether for malicious, accidental, or other reasons. First we update to add the new function:
Then we add a test to :
Then we can test our code:
Note that our module now depends on both and :
Note that our module now depends on both and :
Each different major version ( , , and so on) of a Go module uses a different module path: starting at , the path must end in the major version.
Source: blog.golang.org