Skip to content

Instantly share code, notes, and snippets.

@myitcv
Created October 28, 2018 21:36
Show Gist options
  • Save myitcv/27729e7f6a682133de2bb7f7625bc6c6 to your computer and use it in GitHub Desktop.
Save myitcv/27729e7f6a682133de2bb7f7625bc6c6 to your computer and use it in GitHub Desktop.
gopkg.in/sorcix/irc.v2 to modules
$ git clone https://github.com/sorcix/irc /tmp/irc
Cloning into '/tmp/irc'...
$ cd /tmp/irc
$ git checkout origin/v2
HEAD is now at 63eed78... Merge pull request #33 from TrueFurby/patch-1
$ go mod init
go: creating new go.mod: module gopkg.in/sorcix/irc.v2
$ go mod tidy
$ cd $(mktemp -d)
$ go mod init example.com/hello
go: creating new go.mod: module example.com/hello
$ cat <<EOD >main.go
package main
import (
"fmt"
"gopkg.in/sorcix/irc.v2"
)
func main() {
message := irc.ParseMessage("JOIN #help")
fmt.Println(message.Params[0])
}
EOD
$ go mod edit -require=gopkg.in/sorcix/irc.v2@latest -replace=gopkg.in/sorcix/irc.v2=/tmp/irc
$ go run .
go: finding gopkg.in/sorcix/irc.v2 latest
#help
$ go list -m -json all
{
"Path": "example.com/hello",
"Main": true,
"Dir": "/tmp/tmp.95FXgWKMgp",
"GoMod": "/tmp/tmp.95FXgWKMgp/go.mod"
}
{
"Path": "gopkg.in/sorcix/irc.v2",
"Version": "v2.0.0-20180626144439-63eed78b082d",
"Replace": {
"Path": "/tmp/irc",
"Dir": "/tmp/irc"
},
"Time": "2018-06-26T14:44:39Z",
"Dir": "/tmp/irc",
"GoMod": "/tmp/irc/go.mod"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment