Struct 为什么';我的结构代码不能工作吗?

Struct 为什么';我的结构代码不能工作吗?,struct,go,Struct,Go,我似乎不明白为什么这不起作用。我得到的错误是: package app type ConfigSet struct { installed bool } import ( "fmt" "html/template" "net/http" ) func init() { config := ConfigSet{} // -------------------------------------- // // C

我似乎不明白为什么这不起作用。我得到的错误是:

package app

type ConfigSet struct {
    installed bool
}

import (
    "fmt"
    "html/template"
    "net/http"
)

func init() {
    config := ConfigSet{}

    // -------------------------------------- //
    //             CONFIGURATION              //
    // -------------------------------------- //

    // Change to "true" after configuration is done!
    config.installed = false

    // -------------------------------------- //
    //           END CONFIGURATION            //
    // -------------------------------------- //

    http.HandleFunc("/", index)
    http.HandleFunc("/index.php", index)
}

func index(w http.ResponseWriter, r *http.Request) {
    if config.installed == false {
        w.Header().Set("Location", "/install/")
        return
    }
}

我不明白,我应该在那里申报什么吗?

类型
开始工作之前,先把你的
导入
。围棋肯定比我最初想象的要难,并不难;我建议先在本地开发,然后再开发GAE。你会对事物有更好的感觉。
2012/05/21 13:22:01 go-app-builder: Failed parsing input (1 error)
2012/05/21 13:22:01 /root/TravianGAE/app/app.go:7:1: expected declaration, found 'import'