Skip to content

Commit 489b13b

Browse files
committed
fix: linters
1 parent 8129218 commit 489b13b

32 files changed

+982
-808
lines changed

.dagger/build.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -239,25 +239,6 @@ func goModule() *dagger.Go {
239239
WithBuildCache(cacheVolume("go-build"))
240240
}
241241

242-
func goModuleCross(platform dagger.Platform) *dagger.Go {
243-
container := goModule().
244-
WithCgoEnabled(). // TODO: set env var instead?
245-
Container().
246-
With(func(c *dagger.Container) *dagger.Container {
247-
if platform != "" {
248-
c = c.WithEnvVariable("TARGETPLATFORM", string(platform))
249-
}
250-
251-
return c
252-
}).
253-
WithDirectory("/", dag.Container().From(xxBaseImage).Rootfs()).
254-
WithExec([]string{"apk", "add", "--update", "--no-cache", "ca-certificates", "make", "git", "curl", "clang", "lld"}).
255-
WithExec([]string{"xx-apk", "add", "--update", "--no-cache", "musl-dev", "gcc"}).
256-
WithExec([]string{"xx-go", "--wrap"})
257-
258-
return dag.Go(dagger.GoOpts{Container: container})
259-
}
260-
261242
func (m *Build) HelmChart(
262243
// Name of the chart to build.
263244
name string,

.dagger/dev.go

Lines changed: 0 additions & 113 deletions
This file was deleted.

.dagger/generate.go

Lines changed: 0 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
package main
22

33
import (
4-
"context"
5-
"fmt"
6-
74
"github.com/openmeterio/openmeter/.dagger/internal/dagger"
85
)
96

@@ -19,51 +16,6 @@ type Generate struct {
1916
Source *dagger.Directory
2017
}
2118

22-
// Generate OpenAPI from TypeSpec.
23-
func (m *Generate) Openapi() *dagger.File {
24-
file := typespecBase(m.Source.Directory("api/spec")).
25-
WithExec([]string{"pnpm", "compile"}).
26-
File("/work/output/openapi.OpenMeter.yaml").
27-
WithName("openapi.yaml")
28-
29-
// https://github.com/microsoft/typespec/issues/2154
30-
file = dag.Container().
31-
From("alpine").
32-
WithFile("/work/openapi.yaml", file).
33-
WithWorkdir("/work").
34-
File("/work/openapi.yaml")
35-
36-
return file
37-
}
38-
39-
// Generate OpenAPI from TypeSpec.
40-
func (m *Generate) Openapicloud() *dagger.File {
41-
file := typespecBase(m.Source.Directory("api/spec")).
42-
WithExec([]string{"pnpm", "compile"}).
43-
File("/work/output/openapi.OpenMeterCloud.yaml").
44-
WithName("openapi.cloud.yaml")
45-
46-
// https://github.com/microsoft/typespec/issues/2154
47-
file = dag.Container().
48-
From("alpine").
49-
WithFile("/work/openapi.cloud.yaml", file).
50-
WithWorkdir("/work").
51-
File("/work/openapi.cloud.yaml")
52-
53-
return file
54-
}
55-
56-
func typespecBase(source *dagger.Directory) *dagger.Container {
57-
return dag.Container().
58-
From(NODEJS_CONTAINER_IMAGE).
59-
WithEnvVariable("CI", "true").
60-
WithExec([]string{"npm", "install", "-g", fmt.Sprintf("corepack@v%s", COREPACK_VERSION)}).
61-
WithExec([]string{"corepack", "enable"}).
62-
WithDirectory("/work", source).
63-
WithWorkdir("/work").
64-
WithExec([]string{"pnpm", "install", "--frozen-lockfile"})
65-
}
66-
6719
// Generate the Python SDK.
6820
func (m *Generate) PythonSdk() *dagger.Directory {
6921
// We build our image as the official autorest Dockerfile is outdated
@@ -83,59 +35,3 @@ func (m *Generate) PythonSdk() *dagger.Directory {
8335
WithExec([]string{"autorest", "config.yaml"}).
8436
Directory("/work/client/python")
8537
}
86-
87-
// Generate the JavaScript SDK.
88-
func (m *Generate) JavascriptSdk() *dagger.Directory {
89-
return dag.Container().
90-
From(NODEJS_CONTAINER_IMAGE).
91-
WithExec([]string{"npm", "install", "-g", fmt.Sprintf("corepack@v%s", COREPACK_VERSION)}).
92-
WithExec([]string{"corepack", "enable"}).
93-
WithDirectory("/work", m.Source.Directory("api")).
94-
WithWorkdir("/work/client/javascript").
95-
WithExec([]string{"pnpm", "install", "--frozen-lockfile"}).
96-
WithExec([]string{"pnpm", "run", "generate"}).
97-
WithExec([]string{"pnpm", "build"}).
98-
WithExec([]string{"pnpm", "test"}).
99-
Directory("/work/client/javascript").
100-
WithoutDirectory("node_modules")
101-
}
102-
103-
func (m *Generate) Server() *dagger.Directory {
104-
openapi := m.Openapi()
105-
cloud := m.Openapicloud()
106-
107-
source := m.Source.
108-
WithFile("api/openapi.yaml", openapi).
109-
WithFile("api/openapi.cloud.yaml", cloud)
110-
111-
return goModule().
112-
WithSource(source).
113-
Exec([]string{"go", "generate", "-x", "./api"}).
114-
Directory("/work/src/api")
115-
}
116-
117-
func (m *Generate) Check(ctx context.Context) error {
118-
result := goModuleCross("").
119-
WithSource(m.Source).
120-
WithEnvVariable("GOFLAGS", "-tags=musl").
121-
Exec([]string{"go", "generate", "-x", "./..."}).
122-
Directory("")
123-
124-
err := diff(ctx, m.Source, result)
125-
if err != nil {
126-
return fmt.Errorf("go generate wasn't run: %w", err)
127-
}
128-
129-
return nil
130-
}
131-
132-
func diff(ctx context.Context, d1, d2 *dagger.Directory) error {
133-
_, err := dag.Container(dagger.ContainerOpts{Platform: ""}).
134-
From(alpineBaseImage).
135-
WithDirectory("src", d1).
136-
WithDirectory("res", d2).
137-
WithExec([]string{"diff", "-u", "-r", "-q", "src", "res"}).
138-
Sync(ctx)
139-
140-
return err
141-
}

.dagger/lint.go

Lines changed: 0 additions & 61 deletions
This file was deleted.

.dagger/test.go

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)