Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
GOPATH モードからモジュール対応モードへ移行せよ ref:
- env:
- GO111MODULE=on
language: go
- "1.11.x"
- env GO111MODULE=on go mod download
- env GO111MODULE=on go test ./...
- test -n "$TRAVIS_TAG" && curl -sL | bash
$ go help mod
Go mod provides access to operations on modules.
Note that support for modules is built into all the go commands,
not just 'go mod'. For example, day-to-day adding, removing, upgrading,
and downgrading of dependencies should be done using 'go get'.
See 'go help modules' for an overview of module functionality.
go mod <command> [arguments]
The commands are:
download download modules to local cache
edit edit go.mod from tools or scripts
graph print module requirement graph
init initialize new module in current directory
tidy add missing and remove unused modules
vendor make vendored copy of dependencies
verify verify dependencies have expected content
why explain why packages or modules are needed
Use "go help mod <command>" for more information about a command.
$ go list -m -u all
go: finding v0.8.0
go: finding v1.0.2
go: finding v0.0.3
go: finding v0.3.0
go: finding v0.8.0
go: finding v1.0.0
go: finding v0.0.0-20180816225734-aabede6cba87
go: finding latest
go: finding v0.3.1 v0.3.0 [v0.3.1] v1.0.0 v0.8.0 v0.0.3 v1.0.2 v0.8.0 v0.0.0-20180816225734-aabede6cba87 [v0.0.0-20180910181607-0e37d006457b]
$ go run md2html.go
go: finding v2.0.1
go: go.mod has non-....v2 module path "" at revision v2.0.1
go: error loading module requirements
$ go mod init hello
go: creating new go.mod: module hello
$ go run md2html.go
go: finding v2.0.1
go: downloading v2.0.1
go: finding latest
go: downloading v0.0.0-20170918181015-86672fcb3f95
<p>Hello, World!</p>
$ go run hello.go
go: finding v1.5.2
go: downloading v1.5.2
go: finding v1.3.0
go: finding v0.0.0-20170915032832-14c0d48ead0c
go: downloading v1.3.0
go: downloading v0.0.0-20170915032832-14c0d48ead0c
Hello, world.
$ go mod graph
$ go mod init
go: creating new go.mod: module
go: copying requirements from Gopkg.lock
module md2html
require ( v0.0.0-20170918181015-86672fcb3f95 // indirect v2.0.1
replace v2.0.1 => v2.0.1
package main
import (
func main() {
package main
import (
func main() {
md, err := ioutil.ReadFile(os.Args[1])
if err != nil {
fmt.Fprintln(os.Stderr, err)
html := blackfriday.Run(md)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment