Dev*_*Dev 2 json go unmarshalling

我正在努力学习围棋。我正在编写一个简单的程序来从 GoLang 的 JSON 文件中获取值。

package main

import (
     "encoding/json"
    "fmt"
    "io/ioutil"
    "os"
)
type bands struct {
    id string `json:"id"`
    name  string `json:"name"`
    location  string `json:"location"`
    year  string `json:"year"`
}
func main() {

    bands := getBands()
    fmt.Println(bands)
}

func getBands() []bands {
    raw, err := ioutil.ReadFile("../data/bands.json")
    if err != nil {
        fmt.Println(err.Error())
        os.Exit(1)
    }

    var c []bands
    json.Unmarshal(raw, &c)
    return c
}

另外,下面是我的 JSON 文件:

[{"id":"1","name": "The Beatles","location": "NY","year": "2012"},
{"id":"2","name": "Nirvana","location": "NY","year": "2010"},
{"id":"3","name": "Metallica","location": "NY","year": "1980"}]

当我运行文件时,我得到空白值。

谢谢您的帮助。