Skip to content

Commit 26a9932

Browse files
Andrea Luzzardigsnaiper
authored andcommitted
ci: linter (dagger#182)
* ci: linter Signed-off-by: Andrea Luzzardi <al@dagger.io> * lint: environment setup Signed-off-by: Andrea Luzzardi <al@dagger.io> --------- Signed-off-by: Andrea Luzzardi <al@dagger.io>
1 parent 3df55c1 commit 26a9932

File tree

5 files changed

+43
-4
lines changed

5 files changed

+43
-4
lines changed

.container-use/AGENT.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ DEVELOPMENT WORKFLOW:
66
- Build: Use 'go build -o cu ./cmd/cu' or 'dagger call build --platform=current export --path ./cu'
77
- Test: Run 'go test ./...' for all tests, 'go test -short ./...' for unit tests only, or 'go test -count=1 -v ./environment' for integration tests
88
- Format: Always run 'go fmt ./...' before committing
9+
- Lint: Run 'golangci-lint run' to check for linting issues
910
- Dependencies: Run 'go mod download' to install dependencies, 'go mod tidy' to clean up
1011

1112
DAGGER MODULE (more details in .dagger/):
@@ -17,11 +18,12 @@ AVAILABLE TOOLS:
1718
- Docker (for container runtime needed by the tool)
1819
- Dagger v0.18.11 (matches dagger.json)
1920
- Git with test user configured (test dependency, NOT for version control)
21+
- golangci-lint v1.61.0 (Go linter with various checks)
2022

2123
PROJECT STRUCTURE:
2224
- cmd/cu: Main CLI application entry point
2325
- environment/: Core environment management logic
2426
- mcpserver/: MCP (Model Context Protocol) server implementation
2527
- examples/: Example configurations and usage
2628
- docs/: Documentation and images
27-
- .dagger/: Dagger module configuration
29+
- .dagger/: Dagger module configuration

.container-use/environment.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"curl -fsSL https://get.docker.com | sh",
77
"cd /tmp \u0026\u0026 curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=v0.18.11 sh \u0026\u0026 cp ./bin/dagger /usr/local/bin/dagger",
88
"git config --global user.name \"Test User\"",
9-
"git config --global user.email \"test@dagger.com\""
9+
"git config --global user.email \"test@dagger.com\"",
10+
"curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin v1.61.0"
1011
]
11-
}
12+
}

.dagger/main.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,11 @@ func (m *ContainerUse) Test(ctx context.Context,
8686
WithExec(args, dagger.ContainerWithExecOpts{ExperimentalPrivilegedNesting: true}).
8787
Stdout(ctx)
8888
}
89+
90+
// Test runs the linter
91+
func (m *ContainerUse) Lint(ctx context.Context) error {
92+
return dag.
93+
Golangci().
94+
Lint(m.Source, dagger.GolangciLintOpts{}).
95+
Assert(ctx)
96+
}

.github/workflows/lint.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
jobs:
11+
lint:
12+
name: Lint
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Run tests
19+
uses: dagger/dagger-for-github@8.0.0
20+
with:
21+
version: "latest"
22+
verb: call
23+
args: lint

dagger.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "container-use",
3-
"engineVersion": "v0.18.11",
3+
"engineVersion": "v0.18.12",
44
"sdk": {
55
"source": "go"
66
},
@@ -10,6 +10,11 @@
1010
"source": "github.com/dagger/dagger/modules/go",
1111
"pin": "ccb4c2d98bce247d22c6b281126eac0ed7c41071"
1212
},
13+
{
14+
"name": "golangci",
15+
"source": "github.com/dagger/dagger/modules/golangci",
16+
"pin": "a569ec610a25df6c94cfe4bb55be02a8ade11f32"
17+
},
1318
{
1419
"name": "goreleaser",
1520
"source": "github.com/act3-ai/dagger/goreleaser",

0 commit comments

Comments
 (0)