Skip to content

Commit 0ab6e45

Browse files
committed
refactor: simplify project architecture
regroup logic which was broken down in too many files make most functions public move unit tests in proper locations
1 parent e2aaffa commit 0ab6e45

22 files changed

Lines changed: 1714 additions & 1804 deletions

Containerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ENV GO111MODULE=on \
1515
RUN go mod tidy && \
1616
go build -ldflags "-X 'main.version=${VERSION}'" -o /app/bin/gitlab-sync ./cmd/main.go
1717

18-
FROM alpine:3.22.0 as security_provider
18+
FROM alpine:3.22.0 AS security_provider
1919

2020
RUN addgroup -S gitlab-sync \
2121
&& adduser -S gitlab-sync -G gitlab-sync

cmd/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func main() {
3030
Long: "Fully customizable gitlab repositories and groups mirroring between two (or one) gitlab instances.",
3131
Run: func(cmd *cobra.Command, cmdArgs []string) {
3232
// Set up the logger
33-
setupZapLogger(args.Verbose, strings.TrimSpace(logFile))
33+
SetupZapLogger(args.Verbose, strings.TrimSpace(logFile))
3434
zap.L().Debug("Verbose mode enabled")
3535
zap.L().Debug("Parsing command line arguments")
3636

@@ -128,11 +128,11 @@ func promptForMandatoryInput(defaultValue string, prompt string, errorMsg string
128128
return input
129129
}
130130

131-
// setupZapLogger sets up the Zap logger with the specified verbosity level and optional file output.
131+
// SetupZapLogger sets up the Zap logger with the specified verbosity level and optional file output.
132132
// It configures the logger to use ISO8601 time format and capitalizes the log levels.
133133
// The logger is set to production mode by default, but can be configured for debug mode if verbose is true.
134134
// If filename is not empty, the logger's output is redirected to the specified file.
135-
func setupZapLogger(verbose bool, filename string) {
135+
func SetupZapLogger(verbose bool, filename string) {
136136
// Set up the logger configuration
137137
config := zap.NewProductionConfig()
138138
config.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder

cmd/main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func TestSetupZapLogger(t *testing.T) {
6161
for _, tc := range tests {
6262
t.Run(tc.name, func(t *testing.T) {
6363
// Call the setup function with appropriate parameters.
64-
setupZapLogger(tc.verbose, tc.filename)
64+
SetupZapLogger(tc.verbose, tc.filename)
6565

6666
// Check that the logger's log level for debug is set as expected.
6767
if zap.L().Core().Enabled(zap.DebugLevel) != tc.debugExpected {

internal/mirroring/get.go

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

internal/mirroring/get_group.go

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

0 commit comments

Comments
 (0)