viper-go

    0熱度

    1回答

    我正在嘗試使用viper讀取yaml配置文件(see viper docs)。但我看不到一種方法來讀取問題類型下的地圖值序列。我試過了各種Get_方法 ,但似乎沒有人支持這一點。 remote: host: http://localhost/ user: admin password: changeit mapping: source-project-k

    1熱度

    1回答

    眼鏡蛇和毒蛇的文檔令我困惑。我做了cobra init fooproject,然後在項目目錄中我做了cobra add bar。我有一個名爲foo的PersistentFlag,這裏是root命令的init函數。 func Execute() { if err := RootCmd.Execute(); err != nil { fmt.Println(err)

    0熱度

    2回答

    我有以下JSON這需要轉換爲YAML { "siteidparam": "lid", "sites": [ { "name": "default", "routingmethod": { "method": "urlparam", "siteid": "default", "urlpath": "defaul

    0熱度

    1回答

    這裏下面是toml格式我的配置文件... [[hosts]] name = "host1" username = "user1" password = "password1" [[hosts]] name = "host2" username = "user2" password = "password2" ...這是我的代碼加載它: import ( "fmt"

    0熱度

    1回答

    我有以下的配置我想用毒蛇加載: artist: name: The Beatles albums: - name: The White Album year: 1968 - name: Abbey Road year: 1969 我無法工作,如何加載地圖的列表。我想我需要解組只是這個關鍵,但此代碼不起作用: type Album st

    6熱度

    1回答

    我正在用Go開發一個Web應用程序。目前爲止這麼好,但現在我正在將Wercker作爲CI工具並開始關注測試。但是我的應用很大程度上依賴於Cobra/Viper配置/ flags/environment_variables方案,並且我不知道如何在運行測試套件之前正確初始化Viper值。任何幫助將非常感激。