Skip to content

Commit 1bc9d8c

Browse files
committed
chore(builder): fmt go code
1 parent bd6c0fa commit 1bc9d8c

35 files changed

Lines changed: 98 additions & 106 deletions

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ FROM registry.drycc.cc/drycc/base:${CODENAME}
1212
ENV DRYCC_UID=1001 \
1313
DRYCC_GID=1001 \
1414
DRYCC_HOME_DIR=/workspace \
15-
MC_VERSION="2025.04.03.17.07.56" \
15+
MC_VERSION="2025.08.13.08.35.41" \
1616
JQ_VERSION="1.7.1"
1717

1818
RUN groupadd drycc --gid ${DRYCC_GID} \

boot.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package main provides the entry point for the Drycc builder service.
12
package main
23

34
import (
@@ -62,7 +63,6 @@ func main() {
6263
}
6364
var storageDriver storagedriver.StorageDriver
6465
storageDriver, err = factory.Create(context.Background(), "s3", storageParams)
65-
6666
if err != nil {
6767
return fmt.Errorf("error creating storage driver (%s)", err)
6868
}
@@ -119,7 +119,6 @@ func main() {
119119
}
120120
var storageDriver storagedriver.StorageDriver
121121
storageDriver, err = factory.Create(context.Background(), "s3", storageParams)
122-
123122
if err != nil {
124123
return fmt.Errorf("error creating storage driver (%s)", err)
125124
}

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ go 1.25
55
require (
66
github.com/aws/aws-sdk-go v1.55.6
77
github.com/distribution/distribution/v3 v3.0.0
8-
github.com/drycc/controller-sdk-go v0.0.0-20250625050826-8be5432737be
9-
github.com/drycc/pkg v0.0.0-20250324060552-65752139ab2f
8+
github.com/drycc/controller-sdk-go v0.0.0-20250930075415-578495a55414
9+
github.com/drycc/pkg v0.0.0-20250917064731-345368da3dbf
1010
github.com/google/uuid v1.6.0
1111
github.com/kelseyhightower/envconfig v1.4.0
1212
github.com/stretchr/testify v1.10.0

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ github.com/distribution/distribution/v3 v3.0.0 h1:q4R8wemdRQDClzoNNStftB2ZAfqOiN
2020
github.com/distribution/distribution/v3 v3.0.0/go.mod h1:tRNuFoZsUdyRVegq8xGNeds4KLjwLCRin/tTo6i1DhU=
2121
github.com/docker/go-metrics v0.0.1 h1:AgB/0SvBxihN0X8OR4SjsblXkbMvalQ8cjmtKQ2rQV8=
2222
github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw=
23-
github.com/drycc/controller-sdk-go v0.0.0-20250625050826-8be5432737be h1:aIdgIpvYa6SuPQIV3C3UKNItMaTK3YDxP0sRlfrYSUE=
24-
github.com/drycc/controller-sdk-go v0.0.0-20250625050826-8be5432737be/go.mod h1:MbFxGlgRQUaVlThbn3DmB06EJsf+e3/O+qgbWmdvtoE=
25-
github.com/drycc/pkg v0.0.0-20250324060552-65752139ab2f h1:/OV4bY2yQDu0mg3l5wdJG6d2tal1hbSX+uI5eiQBQ4o=
26-
github.com/drycc/pkg v0.0.0-20250324060552-65752139ab2f/go.mod h1:Ss0KonBbfmUVv4bdL+8QAhLtzuBik7DS5tJTMAhycaI=
23+
github.com/drycc/controller-sdk-go v0.0.0-20250930075415-578495a55414 h1:wiVKgwQsSEBbrQj92Lor6YknaAwPUVp1s/VmAmS3/lI=
24+
github.com/drycc/controller-sdk-go v0.0.0-20250930075415-578495a55414/go.mod h1:eHcmYwg81ASlP55/U587xnBZnZoeZnPHXGeQ8nYWnsg=
25+
github.com/drycc/pkg v0.0.0-20250917064731-345368da3dbf h1:CYy3NoPhfFhkGAbEppTOQfY/HC2s0FJDcBgbtRKeweg=
26+
github.com/drycc/pkg v0.0.0-20250917064731-345368da3dbf/go.mod h1:BrrNrNskHKm+nJYhXfGuI114w8nupi0AMo8QZHID7CM=
2727
github.com/emicklei/go-restful/v3 v3.12.2 h1:DhwDP0vY3k8ZzE0RunuJy8GhNpPL6zqLkDf9B/a0/xU=
2828
github.com/emicklei/go-restful/v3 v3.12.2/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
2929
github.com/fxamacker/cbor/v2 v2.8.0 h1:fFtUGXUzXPHTIUdne5+zzMPTfffl3RD5qYnkY40vtxU=

pkg/cleaner/cleaner.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"github.com/drycc/builder/pkg/sys"
1818
"github.com/drycc/pkg/log"
1919
corev1 "k8s.io/api/core/v1"
20-
2120
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2221
)
2322

@@ -85,7 +84,6 @@ func dirHasGitSuffix(dir string) bool {
8584
}
8685

8786
func deleteFromStorage(app string, storageDriver storagedriver.StorageDriver) error {
88-
8987
// delete all files matching app
9088
objs, err := storageDriver.List(context.Background(), "home")
9189
if err != nil {

pkg/conf/config.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package conf provides configuration utilities for the builder service.
12
package conf
23

34
import (
@@ -40,7 +41,7 @@ func GetStorageParams(env sys.Env) (Parameters, error) {
4041

4142
mEndpoint := env.Get(storageEndpointEnvVar)
4243
params["regionendpoint"] = mEndpoint
43-
region := "us-east-1" //region is required in distribution
44+
region := "us-east-1" // region is required in distribution
4445
if endpointURL, err := url.Parse(mEndpoint); err == nil {
4546
if endpointURL.Hostname() != "" && net.ParseIP(endpointURL.Hostname()) == nil {
4647
region = strings.Split(endpointURL.Hostname(), ".")[0]

pkg/conf/config_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
)
1111

1212
func TestGetStorageParams(t *testing.T) {
13-
1413
env := sys.NewFakeEnv()
1514
env.Envs = map[string]string{
1615
"DRYCC_STORAGE_BUCKET": "builder",
@@ -45,7 +44,7 @@ func TestGetControllerClient(t *testing.T) {
4544

4645
ServiceKeyLocation = filepath.Join(tmpDir, "service-key")
4746
data := []byte("testbuilderkey")
48-
if err := os.WriteFile(ServiceKeyLocation, data, 0644); err != nil {
47+
if err := os.WriteFile(ServiceKeyLocation, data, 0o644); err != nil {
4948
t.Fatalf("error creating %s (%s)", ServiceKeyLocation, err)
5049
}
5150

pkg/controller/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package controller provides utilities for interacting with the Drycc controller.
12
package controller
23

34
import (
@@ -8,7 +9,6 @@ import (
89

910
// New creates a new SDK client configured as the builder.
1011
func New(url string) (*drycc.Client, error) {
11-
1212
client, err := drycc.New(true, url, "")
1313
if err != nil {
1414
return client, err

pkg/controller/utils_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ import (
77
"testing"
88

99
builderconf "github.com/drycc/builder/pkg/conf"
10-
"github.com/stretchr/testify/assert"
11-
1210
drycc "github.com/drycc/controller-sdk-go"
11+
"github.com/stretchr/testify/assert"
1312
)
1413

1514
func TestNew(t *testing.T) {
@@ -26,7 +25,7 @@ func TestNew(t *testing.T) {
2625

2726
builderconf.ServiceKeyLocation = filepath.Join(tmpDir, "service-key")
2827
data := []byte("testbuilderkey")
29-
if err := os.WriteFile(builderconf.ServiceKeyLocation, data, 0644); err != nil {
28+
if err := os.WriteFile(builderconf.ServiceKeyLocation, data, 0o644); err != nil {
3029
t.Fatalf("error creating %s (%s)", builderconf.ServiceKeyLocation, err)
3130
}
3231

pkg/git/git.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package git provides Git repository handling functionality for the SSH server.
12
package git
23

34
// This file just contains the Git-specific portions of sshd.
@@ -45,8 +46,8 @@ var preReceiveHookTpl = template.Must(template.New("hooks").Parse(preReceiveHook
4546
func Receive(
4647
repo, operation, gitHome string,
4748
channel ssh.Channel,
48-
fingerprint, username, conndata, receivetype string) error {
49-
49+
fingerprint, username, conndata, receivetype string,
50+
) error {
5051
log.Info("receiving git repo name: %s, operation: %s, fingerprint: %s, user: %s", repo, operation, fingerprint, username)
5152

5253
if receivetype == "mock" {
@@ -138,7 +139,7 @@ func createRepo(repoPath string) (bool, error) {
138139
} else if os.IsNotExist(err) {
139140
log.Debug("Creating new directory at %s", repoPath)
140141
// Create directory
141-
if err := os.MkdirAll(repoPath, 0755); err != nil {
142+
if err := os.MkdirAll(repoPath, 0o755); err != nil {
142143
log.Err("Failed to create repository: %s", err)
143144
return false, err
144145
}
@@ -169,7 +170,7 @@ func createPreReceiveHook(gitHome, repoPath string) error {
169170
if err := preReceiveHookTpl.Execute(fd, map[string]string{"GitHome": gitHome}); err != nil {
170171
return fmt.Errorf("cannot write pre-receive hook to %s (%s)", writePath, err)
171172
}
172-
if err := os.Chmod(writePath, 0755); err != nil {
173+
if err := os.Chmod(writePath, 0o755); err != nil {
173174
return fmt.Errorf("cannot change pre-receive hook script permissions (%s)", err)
174175
}
175176

0 commit comments

Comments
 (0)