周刊维护在:https://github.com/eryajf/learning-weekly (opens new window) 欢迎投稿,推荐或自荐项目 /文章 /博客,请提交 issue 。
周刊核心为运维周刊,还会侧重 Go 语言生态,Vue 相关技术生态的项目,以及 GitHub 上优秀项目或经验。
你也可以在我的博客 https://wiki.eryajf.net/learning-weekly/ (opens new window) 查看汇总周刊。
🔥 有不少人想单独从博客通过 RSS 订阅周刊的更新,现在它来了,你可以使用这个🔗 链接 (opens new window)进行订阅。
执行如下命令:
echo '{"age":37,"user_height_m":2}' \
'{"age":38,"user_height_m":1.7,"favoriteFoods":["cake"]}' \
| gojsonstruct
1
2
3
将会得到如下输出:
package main
type T struct {
Age int `json:"age"`
FavoriteFoods []string `json:"favoriteFoods,omitempty"`
UserHeightM float64 `json:"user_height_m"`
}
1
2
3
4
5
6
7
// main.go
package main
import "fmt"
func main() {
fmt.Println("hello world")
}
1
2
3
4
5
6
7
8
指定 earthly 配置如下:
# Earthfile
VERSION 0.8
FROM golang:1.15-alpine3.13
RUN apk --update --no-cache add git
WORKDIR /go-example
all:
BUILD +lint
BUILD +docker
build:
COPY main.go .
RUN go build -o build/go-example main.go
SAVE ARTIFACT build/go-example AS LOCAL build/go-example
lint:
RUN go get golang.org/x/lint/golint
COPY main.go .
RUN golint -set_exit_status ./...
docker:
COPY +build/go-example .
ENTRYPOINT ["/go-example/go-example"]
SAVE IMAGE go-example:latest
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
然后执行 earthly +all 命令进行构建:
可以考虑作为构建工具集成到流水线当中。


申明
原创文章eryajf,未经授权,严禁转载,侵权必究!此乃文中随机水印,敬请读者谅解。
${} 的方式来引用,而不要直接引用,否则变量会被解析,且解析为空。--privileged --cap-add=SYS_PTRACE --security-opt seccomp=unconfined 参数来解决。周刊维护在:https://github.com/eryajf/learning-weekly (opens new window) 欢迎投稿,推荐或自荐项目 /文章 /博客,请提交 issue 。
周刊核心为运维周刊,还会侧重 Go 语言生态,Vue 相关技术生态的项目,以及 GitHub 上优秀项目或经验。
你也可以在我的博客 https://wiki.eryajf.net/learning-weekly/ (opens new window) 查看汇总周刊。
🔥 有不少人想单独从博客通过 RSS 订阅周刊的更新,现在它来了,你可以使用这个🔗 链接 (opens new window)进行订阅。
执行如下命令:
echo '{"age":37,"user_height_m":2}' \
'{"age":38,"user_height_m":1.7,"favoriteFoods":["cake"]}' \
| gojsonstruct
1
2
3
将会得到如下输出:
package main
type T struct {
Age int `json:"age"`
FavoriteFoods []string `json:"favoriteFoods,omitempty"`
UserHeightM float64 `json:"user_height_m"`
}
1
2
3
4
5
6
7
// main.go
package main
import "fmt"
func main() {
fmt.Println("hello world")
}
1
2
3
4
5
6
7
8
指定 earthly 配置如下:
# Earthfile
VERSION 0.8
FROM golang:1.15-alpine3.13
RUN apk --update --no-cache add git
WORKDIR /go-example
all:
BUILD +lint
BUILD +docker
build:
COPY main.go .
RUN go build -o build/go-example main.go
SAVE ARTIFACT build/go-example AS LOCAL build/go-example
lint:
RUN go get golang.org/x/lint/golint
COPY main.go .
RUN golint -set_exit_status ./...
docker:
COPY +build/go-example .
ENTRYPOINT ["/go-example/go-example"]
SAVE IMAGE go-example:latest
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
然后执行 earthly +all 命令进行构建:
可以考虑作为构建工具集成到流水线当中。


申明
原创文章eryajf,未经授权,严禁转载,侵权必究!此乃文中随机水印,敬请读者谅解。
${} 的方式来引用,而不要直接引用,否则变量会被解析,且解析为空。--privileged --cap-add=SYS_PTRACE --security-opt seccomp=unconfined 参数来解决。