プロジェクト
GitHubで見る
compose-spec/compose-go
概要
ComposeのYAMLファイルを解析して読み込むためのリファレンスライブラリ。
開発ツール計測したスター増加
- 24時間
- 0
- 7日間
- +1
- 15日間
- +1
- 1か月
- 履歴を収集中
期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。
README.md
オリジナルcompose-go
Go reference library for parsing and loading Compose files as specified by the Compose specification.
Usage
package main
import (
"context"
"fmt"
"log"
"github.com/compose-spec/compose-go/v2/cli"
)
func main() {
composeFilePath := "docker-compose.yml"
projectName := "my_project"
ctx := context.Background()
options, err := cli.NewProjectOptions(
[]string{composeFilePath},
cli.WithOsEnv,
cli.WithDotEnv,
cli.WithName(projectName),
)
if err != nil {
log.Fatal(err)
}
project, err := options.LoadProject(ctx)
if err != nil {
log.Fatal(err)
}
// Use the MarshalYAML method to get YAML representation
projectYAML, err := project.MarshalYAML()
if err != nil {
log.Fatal(err)
}
fmt.Println(string(projectYAML))
}
Build the library
To build the library, you could either use the makefile
make build
or use the go build command
go build ./...
Run the tests
You can run the tests with the makefile
make test
or with the go test command
gotestsum ./...
Other helpful make commands
Run the linter
make lint
Check the license headers
make check-license
Used by
関連プロジェクトを探す
読み込み中…