Hello, I am trying to get variables from another package nevertheless I am getting package pkg/variable is not in GOROOT (C:\Program Files\Go\src\pkg\variable)
. I do not want to create a pkg in goroot, how can I call a package that is not in goroot? My main code is inside Desktop\MyApp
and the variable pkg is in Desktop\MyApp\pkg
. Below the codes showing how I am trying do it:
Variable package (variables.go):
package variables
var (
array_001 = []string{"a", "b", "c"}
array_002 = []string{"1", "2", "3"}
)
The main source (myapp.go):
package main
import (
"fmt"
variables "pkg/variable"
)
func main() {
w := variables.array_001
fmt.Println(w)
}