docs: add simple Go guide
Signed-off-by: Tanguy ⧓ Herrmann <tanguy@dagger.io>
This commit is contained in:
33
docs/guides/1228-go-ci.md
Normal file
33
docs/guides/1228-go-ci.md
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
slug: /1227/go-ci
|
||||
displayed_sidebar: europa
|
||||
---
|
||||
|
||||
# Go project CI
|
||||
|
||||
We want to run some tests and build a Go project with the `go` cue package.
|
||||
|
||||
## Plan
|
||||
|
||||
The plan consist of 2 actions:
|
||||
|
||||
- `test` for `go test`
|
||||
- `build` for `go build`
|
||||
|
||||
both use the [Go dagger package](https://github.com/dagger/dagger/tree/main/pkg/universe.dagger.io/go)
|
||||
|
||||
```cue file=../plans/go-ci/plan.cue
|
||||
```
|
||||
|
||||
## Go project
|
||||
|
||||
The project is a simple program that takes `$NAME` environment variable, use the [Go greeting package](https://github.com/dagger/dagger/tree/main/docs/plans/go-ci/hello/greeting) to print the `greeting.Greet()` out.
|
||||
|
||||
```go file=../plans/go-ci/hello/main.go
|
||||
```
|
||||
|
||||
```go file=../plans/go-ci/hello/greeting/greeting.go
|
||||
```
|
||||
|
||||
```go file=../plans/go-ci/hello/greeting/greeting_test.go
|
||||
```
|
Reference in New Issue
Block a user