这样就可以使用自己想要的库了:
go mod init json
go mod edit -require github.com/gorilla/websocket@latest
go mod edit -require github.com/tidwall/gjson@latest
...
go mod downlaod
example (json.go):
package main
import "github.com/tidwall/gjson"
const json = `{"name":{"first":"Janet","last":"Prichard"},"age":47}`
func main() {
value := gjson.Get(json, "name.last")
println(value.String())
}
go run json.go