Answer the question
In order to leave comments, you need to log in
Structure field not found, connected package?
Greetings Toaster Members!
The code:
// ~/go/src/example/foobar/foobar.go
package foobar
// ...
type FooBar struct {
table map[string]*Relation
}
func NewFooBar() *FooBar {
fb := new(FooBar)
fb.table = make(map[string]*Relation)
return fb
}
// ------------------------ //
// ~/go/src/example/main.go
package main
import (
"fmt"
"example/foobar"
)
func main() {
fb := foobar.NewFooBar()
fmt.Println(fb.table)
}
Answer the question
In order to leave comments, you need to log in
Go exports capitalized names, small private https://golang.org/ref/spec#Exported_identifiers
type FooBar struct {
Table map[string]*Relation // здесь нужно Table вместо table чтобы имя/поле можно было импортировать
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question