How can I track down a function return mismatch in Golang? In two different build environments I am seeing a difference. Both cases should be Visual Studio Code remote to a Linux box, using Go 1.12 in module mode. The broken case is where I am driving the build using the Golang:1.12 Docker image. Below is simplified from where I'm seeing the problem.
So for this sample, derived from https://github.com/satori/go.uuid:
package main
import (
"fmt"
uuid "github.com/satori/go.uuid"
)
func main() {
// or error handling
u2, err := uuid.NewV4()
if err != nil {
fmt.Printf("Something went wrong: %s", err)
return
}
fmt.Printf("UUIDv4: %s\n", u2)
}
The unexpected build error is:
./main.go:11:5 assignment mismatch: 2 variables but uuid.NewV4() returns 1 values
In the environment where I encounter this problem, in Visual Studio Code when I hover with mouse over the call to uuid.NewV4() I see:
func uuid.NewV4() (uuid.UUID, error)
uuid.NewV4 on pkg.go.dev
NewV4 returns random generated UUID.
and hover over uuid shows:
package uuid ("github.com/satori/go.uuid")
uuid on pkg.go.dev
I may switch to a different uuid package to work around this -- but I want to understand better how to figure this out.