小编Tig*_*yan的帖子

如何使Viper中的配置字段成为必填项?

我使用 Viper https://github.com/spf13/viper来管理 GO 应用程序中的项目配置,以及将配置值解组到结构体。

var config c.Configuration // Configuration is my configuration struct

err := viper.Unmarshal(&config)
Run Code Online (Sandbox Code Playgroud)

当我错过 .yml 配置文件中的某些配置时,它在解组期间不会抛出任何错误(正如我所猜测的)。

那么我怎样才能强制实施所有配置呢?如果结构体中的任何字段在 yaml 中没有值,我想查看错误。

yaml go viper-go

11
推荐指数
1
解决办法
4211
查看次数

字符串太大而不能使用UTF-8编写而不是'STRING_TOO_LARGE'

Java编译器错误:string too large to encode using UTF-8 written instead as 'STRING_TOO_LARGE'.

我想要注意的是,我没有长字符串,没有一个矢量可绘制大于32kb(最大是3.7kb).

Gradle 3.2.0,构建工具28.0.3

什么可以带来问题?

java android gradle java-compiler-api kotlin

9
推荐指数
1
解决办法
5248
查看次数

标签 统计

android ×1

go ×1

gradle ×1

java ×1

java-compiler-api ×1

kotlin ×1

viper-go ×1

yaml ×1