Skip to content

Commit 43e2e2a

Browse files
Copilotpjbgf
andcommitted
fix: fix wsl_v5 lint issues for golangci-lint v2.11.4
Agent-Logs-Url: https://github.com/go-git/cli/sessions/131966d7-0bf6-4084-a63e-8a7951010c79 Co-authored-by: pjbgf <5452977+pjbgf@users.noreply.github.com>
1 parent 9dbdbc7 commit 43e2e2a

File tree

5 files changed

+16
-0
lines changed

5 files changed

+16
-0
lines changed

cmd/gogit-http-server/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,22 @@ var rootCmd = &cobra.Command{
3030
RunE: func(cmd *cobra.Command, args []string) error {
3131
directory := args[0]
3232
addr := fmt.Sprintf(":%d", port)
33+
3334
abs, err := filepath.Abs(directory)
3435
if err != nil {
3536
return fmt.Errorf("failed to get absolute path: %w", err)
3637
}
3738

3839
log.Printf("Using absolute path: %q", abs)
40+
3941
logger := log.Default()
4042
loader := transport.NewFilesystemLoader(osfs.New(abs, osfs.WithBoundOS()), false)
4143
gitmw := githttp.NewBackend(loader)
4244

4345
handler := LoggingMiddleware(logger, gitmw)
46+
4447
log.Printf("Starting server on %q for directory %q", addr, directory)
48+
4549
if err := http.ListenAndServe(addr, handler); !errors.Is(err, http.ErrServerClosed) {
4650
return err
4751
}

cmd/gogit/clone.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ var cloneCmd = &cobra.Command{
5656
if cloneTags {
5757
opts.Tags = git.TagFollowing
5858
}
59+
5960
if cloneProgress {
6061
opts.Progress = cmd.OutOrStdout()
6162
}

cmd/gogit/push.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,12 @@ var pushCmd = &cobra.Command{
4444
}
4545

4646
var ep *transport.Endpoint
47+
4748
remoteName := git.DefaultRemoteName
49+
4850
if len(args) > 0 {
4951
isRemote := false
52+
5053
for remote := range cfg.Remotes {
5154
if args[0] == remote {
5255
remoteName = remote
@@ -55,6 +58,7 @@ var pushCmd = &cobra.Command{
5558
break
5659
}
5760
}
61+
5862
if !isRemote {
5963
// Is this a repository URL?
6064
ep, err = transport.NewEndpoint(args[0])
@@ -66,6 +70,7 @@ var pushCmd = &cobra.Command{
6670
}
6771

6872
var refspecs []config.RefSpec
73+
6974
if len(args) > 1 {
7075
for _, arg := range args[1:] {
7176
ref := plumbing.NewBranchReferenceName(arg)
@@ -101,6 +106,7 @@ var pushCmd = &cobra.Command{
101106
}
102107

103108
var isatty bool
109+
104110
stderr := cmd.ErrOrStderr()
105111
if f, ok := stderr.(interface {
106112
Fd() uintptr

cmd/gogit/upload-pack.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ var uploadPackCmd = &cobra.Command{
3535
}
3636

3737
ctx := cmd.Context()
38+
3839
if uploadPackTimeout > 0 {
3940
var cancel context.CancelFunc
41+
4042
ctx, cancel = context.WithTimeout(ctx, time.Duration(uploadPackTimeout)*time.Second)
4143
defer cancel()
4244
}

cmd/gogit/worktree.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ var worktreeAddCmd = &cobra.Command{
6262
if worktreeAddDetach {
6363
opts = append(opts, worktree.WithDetachedHead())
6464
}
65+
6566
if worktreeAddCommit != "" {
6667
hash := plumbing.NewHash(worktreeAddCommit)
6768
if !hash.IsZero() {
@@ -121,13 +122,15 @@ var worktreeListCmd = &cobra.Command{
121122
commonDir := wts.Filesystem()
122123
for _, name := range worktrees {
123124
gitdirPath := filepath.Join(commonDir.Root(), "worktrees", name, "gitdir")
125+
124126
gitdirData, err := os.ReadFile(gitdirPath)
125127
if err != nil || len(gitdirData) == 0 {
126128
continue
127129
}
128130

129131
wtPath := filepath.Dir(string(gitdirData[:len(gitdirData)-1]))
130132
wt := memfs.New()
133+
131134
err = w.Init(wt, name)
132135
if err != nil {
133136
continue

0 commit comments

Comments
 (0)