Created
January 14, 2020 22:06
-
-
Save Huholoman/0917cf5b3947790dde747a1fc2bc0693 to your computer and use it in GitHub Desktop.
./main.go:19:20: foo.Name undefined (type int has no field or method Name)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GNU nano 4.7 main.go Změněno | |
package main | |
import "fmt" | |
type Foo struct { | |
Name string | |
} | |
func getSlices() []Foo { | |
return []Foo{ | |
{Name: "Foo"}, | |
{Name: "Boo"}, | |
} | |
} | |
func main() { | |
foos := getSlices() | |
for foo := range foos { | |
fmt.Println(foo.Name) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment