Skip to content

Commit

Permalink
Update deps to support Go 1.22
Browse files Browse the repository at this point in the history
The dependencies wouldn't build on recent Go versions, which was kind of
annoying. Upgrade dependencies so we can use the latest toolchain.
  • Loading branch information
aaronlehmann committed Mar 2, 2024
1 parent eb069e4 commit 8a27350
Show file tree
Hide file tree
Showing 7 changed files with 578 additions and 840 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "envbuilder",
"image": "mcr.microsoft.com/devcontainers/go:0-1.20",
"image": "mcr.microsoft.com/devcontainers/go:1.22",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker": {}
}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
# Install Go!
- uses: actions/setup-go@v3
with:
go-version: "1.20.5"
go-version: "~1.22"

- name: Test
run: go test ./...
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

- uses: actions/setup-go@v3
with:
go-version: "~1.20"
go-version: "~1.22"

- name: Docker Login
uses: docker/login-action@v2
Expand Down
10 changes: 5 additions & 5 deletions cmd/envbuilder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"time"

"cdr.dev/slog"
"github.com/coder/coder/codersdk"
"github.com/coder/coder/codersdk/agentsdk"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/codersdk/agentsdk"
"github.com/coder/envbuilder"
"github.com/spf13/cobra"

Expand All @@ -32,7 +32,7 @@ func main() {
RunE: func(cmd *cobra.Command, args []string) error {
options := envbuilder.OptionsFromEnv(os.LookupEnv)

var sendLogs func(ctx context.Context, log ...agentsdk.StartupLog) error
var sendLogs func(ctx context.Context, log ...agentsdk.Log) error
agentURL := os.Getenv("CODER_AGENT_URL")
agentToken := os.Getenv("CODER_AGENT_TOKEN")
if agentToken != "" {
Expand All @@ -53,15 +53,15 @@ func main() {
},
}
var flushAndClose func(ctx context.Context) error
sendLogs, flushAndClose = agentsdk.StartupLogsSender(client.PatchStartupLogs, slog.Logger{})
sendLogs, flushAndClose = agentsdk.LogsSender(agentsdk.ExternalLogSourceID, client.PatchLogs, slog.Logger{})
defer flushAndClose(cmd.Context())
}

options.Logger = func(level codersdk.LogLevel, format string, args ...interface{}) {
output := fmt.Sprintf(format, args...)
fmt.Fprintln(cmd.ErrOrStderr(), output)
if sendLogs != nil {
sendLogs(cmd.Context(), agentsdk.StartupLog{
sendLogs(cmd.Context(), agentsdk.Log{
CreatedAt: time.Now(),
Output: output,
Level: level,
Expand Down
2 changes: 1 addition & 1 deletion envbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
"github.com/GoogleContainerTools/kaniko/pkg/creds"
"github.com/GoogleContainerTools/kaniko/pkg/executor"
"github.com/GoogleContainerTools/kaniko/pkg/util"
"github.com/coder/coder/codersdk"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/envbuilder/devcontainer"
"github.com/containerd/containerd/platforms"
"github.com/distribution/distribution/v3/configuration"
Expand Down
236 changes: 127 additions & 109 deletions go.mod

Large diffs are not rendered by default.

1,164 changes: 442 additions & 722 deletions go.sum

Large diffs are not rendered by default.

0 comments on commit 8a27350

Please sign in to comment.