Skip to content

Commit e7494d5

Browse files
committed
📝 docs(config): standardize formatting in config structs for clarity
1 parent 30c5737 commit e7494d5

7 files changed

Lines changed: 22 additions & 26 deletions

File tree

internal/config/config.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import (
99
)
1010

1111
type Config struct {
12-
Source SourceConfig `mapstructure:"source"`
12+
Source SourceConfig `mapstructure:"source"`
1313
Destinations []DestinationConfig `mapstructure:"destinations"`
14-
Images []ImageConfig `mapstructure:"images"`
15-
Schedule string `mapstructure:"schedule"`
16-
StatePath string `mapstructure:"state_path"`
17-
Slack SlackConfig `mapstructure:"slack"`
18-
FailFast bool `mapstructure:"fail_fast"`
14+
Images []ImageConfig `mapstructure:"images"`
15+
Schedule string `mapstructure:"schedule"`
16+
StatePath string `mapstructure:"state_path"`
17+
Slack SlackConfig `mapstructure:"slack"`
18+
FailFast bool `mapstructure:"fail_fast"`
1919
}
2020

2121
type SourceConfig struct {
@@ -35,8 +35,8 @@ type DestinationConfig struct {
3535
}
3636

3737
type ImageConfig struct {
38-
Name string `mapstructure:"name"` // e.g., "library/nginx"
39-
Tags []string `mapstructure:"tags"` // specific tags to sync, empty means all
38+
Name string `mapstructure:"name"` // e.g., "library/nginx"
39+
Tags []string `mapstructure:"tags"` // specific tags to sync, empty means all
4040
WatchTags bool `mapstructure:"watch_tags"` // watch for new tags
4141
}
4242

internal/notify/slack.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,3 @@ func (c *SlackClient) SendText(ctx context.Context, text string) error {
6161
}
6262
return nil
6363
}
64-

internal/registry/dockerhub.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (r *DockerHubRegistry) Authenticate(ctx context.Context) error {
4242
func (r *DockerHubRegistry) ListTags(ctx context.Context, imageName string) ([]string, error) {
4343
// Docker Hub API endpoint for listing tags
4444
apiURL := fmt.Sprintf("https://hub.docker.com/v2/repositories/%s/tags", imageName)
45-
45+
4646
req, err := http.NewRequestWithContext(ctx, "GET", apiURL, nil)
4747
if err != nil {
4848
return nil, err
@@ -190,12 +190,12 @@ func NormalizeDockerHubImage(imageName string) string {
190190
// Remove docker.io prefix if present
191191
imageName = strings.TrimPrefix(imageName, "docker.io/")
192192
imageName = strings.TrimPrefix(imageName, "index.docker.io/")
193-
193+
194194
// If no namespace, assume library
195195
parts := strings.Split(imageName, "/")
196196
if len(parts) == 1 {
197197
return "library/" + parts[0]
198198
}
199-
199+
200200
return imageName
201201
}

internal/registry/generic.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,3 @@ func (r *GenericRegistry) PushImage(ctx context.Context, image, tag, digest stri
7373
func (r *GenericRegistry) GetRegistryURL() string {
7474
return r.registry
7575
}
76-

internal/registry/keychain.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,3 @@ func (k SourceAwareKeychain) Resolve(resource authn.Resource) (authn.Authenticat
2626

2727
return k.Fallback.Resolve(resource)
2828
}
29-

internal/state/state.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99
)
1010

1111
type State struct {
12-
Version int `json:"version"`
13-
UpdatedAt time.Time `json:"updated_at"`
12+
Version int `json:"version"`
13+
UpdatedAt time.Time `json:"updated_at"`
1414
Synced map[string]map[string]map[string]time.Time `json:"synced"` // destName -> image -> tag -> time
1515
}
1616

@@ -104,4 +104,3 @@ func (s *State) MarkSynced(destName, image, tag string) {
104104
}
105105
s.Synced[destName][image][tag] = time.Now().UTC()
106106
}
107-

internal/sync/sync.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ type Report struct {
4242
}
4343

4444
type Syncer struct {
45-
config *config.Config
46-
sourceRegistry registry.Registry
47-
destRegistries []registry.Registry
48-
factory *registry.RegistryFactory
49-
keychain authn.Keychain
50-
statePath string
51-
state *state.State
52-
currentReport *Report
53-
slack *notify.SlackClient
45+
config *config.Config
46+
sourceRegistry registry.Registry
47+
destRegistries []registry.Registry
48+
factory *registry.RegistryFactory
49+
keychain authn.Keychain
50+
statePath string
51+
state *state.State
52+
currentReport *Report
53+
slack *notify.SlackClient
5454
}
5555

5656
func NewSyncer(cfg *config.Config) (*Syncer, error) {

0 commit comments

Comments
 (0)