I am unable to use a struct in package main which has been defined in a different package. Please note that I am importing the other package correctly
I named the struct and its fields starting with a capital letter because I read that in Golang that is how we indicate that it is an exported field. Although it is not required if the package is imported.
fsm.go
package fsm
import (
"fmt"
"strings"
)
// EKey is a struct key used for storing the transition map.
type EKey struct {
// event is the name of the event that the keys refers to.
Event string
// src is the source from where the event can transition.
Src string
}
test.go
package main
import (
"encoding/json"
"fmt"
"github.com/looplab/fsm"
)
func main(){
Transitions := make(map[EKey]string)
}
Error: undefined EKey