1

Let's say I want to import version v0.11.0 of Slack Go package.

In CLI I would call: go get github.com/slack-go/slack@v0.11.0 but in Go Playground I can only use import.

I've tried import "github.com/slack-go/slack@v0.11.0" but that didn't work.

How can I import version v0.11.0 of Slack Go package in Go Playground?

gondo
  • 979
  • 1
  • 10
  • 29

1 Answers1

4

The version you import is determined by go.mod, and go get modifies go.mod, so include the go.mod in the playground example.

package main

import "github.com/slack-go/slack"

func main() {
    _ = slack.New("YOUR_TOKEN_HERE")
}
-- go.mod --
module play.ground

require github.com/slack-go/slack v0.11.0

https://go.dev/play/p/cBt7MR4Kf03

JimB
  • 104,193
  • 13
  • 262
  • 255