:chore: Refactor codes and upgrade golangci-lint in ci
This commit is contained in:
1 parent
a1ad5bafde
commit
1326df816b
4 files changed
+25
-18
No files matched your search
@@ -42,7 +42,7 @@ jobs:
|
||||
- name: Lint
|
||||
uses: golangci/golangci-lint-action@v9
|
||||
with:
|
||||
version: v2.12
|
||||
version: latest
|
||||
- name: Go test
|
||||
run: |
|
||||
go test ./... -coverprofile=${{ env.COVERAGE_FILE }} -coverpkg="./pkg/..."
|
||||
|
||||
@@ -17,7 +17,7 @@ Go CLI + MCP server + Agent for YouTube.
|
||||
| [pkg/](pkg/AGENTS.md) | Core domain logic and shared infrastructure |
|
||||
| [internal/](internal/AGENTS.md) | Internal tools (docgen, skillgen) |
|
||||
| [scripts/](scripts/AGENTS.md) | Utility scripts and smoke tests |
|
||||
| [docs/](docs/) | Project documentation |
|
||||
| [docs/](docs) | Project documentation |
|
||||
|
||||
## Documentation
|
||||
|
||||
|
||||
@@ -118,25 +118,29 @@ func generate() string {
|
||||
}
|
||||
}
|
||||
|
||||
slices.SortFunc(coreCommands, func(a, b *cobra.Command) int {
|
||||
return cmp.Compare(a.Name(), b.Name())
|
||||
})
|
||||
slices.SortFunc(resourceCommands, func(a, b *cobra.Command) int {
|
||||
return cmp.Compare(a.Name(), b.Name())
|
||||
})
|
||||
slices.SortFunc(
|
||||
coreCommands, func(a, b *cobra.Command) int {
|
||||
return cmp.Compare(a.Name(), b.Name())
|
||||
},
|
||||
)
|
||||
slices.SortFunc(
|
||||
resourceCommands, func(a, b *cobra.Command) int {
|
||||
return cmp.Compare(a.Name(), b.Name())
|
||||
},
|
||||
)
|
||||
|
||||
b.WriteString("\n# yutu\n")
|
||||
for _, c := range coreCommands {
|
||||
name := c.Name()
|
||||
fmt.Fprintf(&b, "echo \"======= %s =======\"\n", name)
|
||||
fmt.Fprintf(&b, "\"$YUTU_PATH\" %s --help\n\n", name)
|
||||
_, _ = fmt.Fprintf(&b, "echo \"======= %s =======\"\n", name)
|
||||
_, _ = fmt.Fprintf(&b, "\"$YUTU_PATH\" %s --help\n\n", name)
|
||||
}
|
||||
|
||||
b.WriteString("# youtube api\n")
|
||||
for _, c := range resourceCommands {
|
||||
name := c.Name()
|
||||
fmt.Fprintf(&b, "echo \"======= %s =======\"\n", name)
|
||||
fmt.Fprintf(&b, "\"$YUTU_PATH\" %s --help\n", name)
|
||||
_, _ = fmt.Fprintf(&b, "echo \"======= %s =======\"\n", name)
|
||||
_, _ = fmt.Fprintf(&b, "\"$YUTU_PATH\" %s --help\n", name)
|
||||
|
||||
var subs []*cobra.Command
|
||||
for _, sub := range c.Commands() {
|
||||
@@ -145,13 +149,15 @@ func generate() string {
|
||||
}
|
||||
subs = append(subs, sub)
|
||||
}
|
||||
slices.SortFunc(subs, func(a, b *cobra.Command) int {
|
||||
return cmp.Compare(a.Name(), b.Name())
|
||||
})
|
||||
slices.SortFunc(
|
||||
subs, func(a, b *cobra.Command) int {
|
||||
return cmp.Compare(a.Name(), b.Name())
|
||||
},
|
||||
)
|
||||
|
||||
for _, sub := range subs {
|
||||
fmt.Fprintf(&b, "echo \"------- %s -------\"\n", sub.Name())
|
||||
fmt.Fprintf(&b, "\"$YUTU_PATH\" %s %s --help\n", name, sub.Name())
|
||||
_, _ = fmt.Fprintf(&b, "echo \"------- %s -------\"\n", sub.Name())
|
||||
_, _ = fmt.Fprintf(&b, "\"$YUTU_PATH\" %s %s --help\n", name, sub.Name())
|
||||
}
|
||||
b.WriteString("\n")
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ package utils
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
@@ -468,7 +469,7 @@ func TestConfirmPreRun(t *testing.T) {
|
||||
cmd.SetIn(strings.NewReader(tt.input))
|
||||
|
||||
err := ConfirmPreRun(cmd, "Would do something")
|
||||
if err != tt.wantErr {
|
||||
if !errors.Is(err, tt.wantErr) {
|
||||
t.Errorf("ConfirmPreRun() error = %v, want %v", err, tt.wantErr)
|
||||
}
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user