Skip to content

Commit 51a66ea

Browse files
committedJul 10, 2024
add git commands
1 parent 77b27d3 commit 51a66ea

File tree

9 files changed

+411
-61
lines changed

9 files changed

+411
-61
lines changed
 

‎.golangci.yml

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
run:
2+
skip-dirs:
3+
- (^|/)bin($|/)
4+
- (^|/)tmp($|/)
5+
linters:
6+
enable:
7+
- asciicheck
8+
- bodyclose
9+
- dogsled
10+
- dupl
11+
- funlen
12+
- gochecknoinits
13+
- gocognit
14+
- goconst
15+
- gocritic
16+
- gocyclo
17+
- revive
18+
- gosec
19+
- lll
20+
- misspell
21+
- nakedret
22+
- noctx
23+
- prealloc
24+
- rowserrcheck
25+
- exportloopref
26+
- stylecheck
27+
- unconvert
28+
- unparam
29+
- whitespace
30+
- gofumpt
31+
linters-settings:
32+
lll:
33+
line-length: 193
34+
tab-width: 1
35+
funlen:
36+
lines: 168
37+
statements: 50
38+
gocritic:
39+
disabled-checks:
40+
- singleCaseSwitch
41+
golint:
42+
min-confidence: 0.6
43+
gosimple:
44+
checks: ["all","-S1023"]
45+
gofumpt:
46+
module-path: smolgit
47+
lang-version: "1.22.4"
48+
issues:
49+
exclude-rules:
50+
- path: _test.go
51+
linters:
52+
- funlen
53+
- maligned
54+
- noctx
55+
- scopelint
56+
- bodyclose
57+
- lll
58+
- goconst
59+
- gocognit
60+
- gocyclo
61+
- gochecknoinits
62+
- dupl
63+
- staticcheck
64+
- revive
65+
- gosec
66+
- path: _mock.go
67+
linters:
68+
- funlen
69+
- maligned
70+
- noctx
71+
- scopelint
72+
- bodyclose
73+
- lll
74+
- goconst
75+
- gocognit
76+
- gocyclo
77+
- gochecknoinits
78+
- dupl
79+
- staticcheck
80+
- revive

‎cmd/server.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func Server(version string) *cli.Command {
6262
},
6363
&cli.StringFlag{
6464
Name: "git_path",
65-
Value: "/tmp/smolgit",
65+
Value: "./tmp/smolgit",
6666
Sources: altsrc.YAML("git.path", configs...),
6767
},
6868
&cli.StringFlag{
@@ -126,9 +126,11 @@ func initApp(ctx *cli.Context) error {
126126
if err != nil {
127127
logger.Error("cant run ssh server", "error", err)
128128
return err
129-
130129
}
131-
go sshServer.ListenAndServe()
130+
131+
go func() {
132+
_ = sshServer.ListenAndServe()
133+
}()
132134
return router.Run(addr)
133135
}
134136

@@ -164,6 +166,7 @@ func initLogger(ctx *cli.Context) *slog.Logger {
164166
if err := level.UnmarshalText([]byte(ctx.String("log_level"))); err != nil {
165167
level.Set(slog.LevelDebug)
166168
}
169+
logger.Info("set loglevel", "level", level)
167170

168171
return logger
169172
}

‎config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ server:
88
ssh:
99
addr: ":3081"
1010
git:
11-
path: /tmp/smolgit
11+
path: ./tmp/smolgit
1212
db:
1313
path: ./database.sqlite
1414
root:

‎go.mod

+25
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,77 @@ module smolgit
33
go 1.22.4
44

55
require (
6+
dario.cat/mergo v1.0.0 // indirect
67
github.com/BurntSushi/toml v1.3.2 // indirect
8+
github.com/Microsoft/go-winio v0.6.1 // indirect
9+
github.com/ProtonMail/go-crypto v1.0.0 // indirect
710
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect
811
github.com/bytedance/sonic v1.11.6 // indirect
912
github.com/bytedance/sonic/loader v0.1.1 // indirect
13+
github.com/cloudflare/circl v1.3.7 // indirect
1014
github.com/cloudwego/base64x v0.1.4 // indirect
1115
github.com/cloudwego/iasm v0.2.0 // indirect
1216
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
17+
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
18+
github.com/emirpasic/gods v1.18.1 // indirect
1319
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
1420
github.com/gin-contrib/sse v0.1.0 // indirect
1521
github.com/gin-gonic/gin v1.10.0 // indirect
1622
github.com/gliderlabs/ssh v0.3.7 // indirect
23+
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
24+
github.com/go-git/go-billy v4.2.0+incompatible // indirect
25+
github.com/go-git/go-billy/v5 v5.5.0 // indirect
26+
github.com/go-git/go-git v4.7.0+incompatible // indirect
27+
github.com/go-git/go-git/v5 v5.12.0 // indirect
1728
github.com/go-playground/locales v0.14.1 // indirect
1829
github.com/go-playground/universal-translator v0.18.1 // indirect
1930
github.com/go-playground/validator/v10 v10.20.0 // indirect
2031
github.com/goccy/go-json v0.10.2 // indirect
32+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
2133
github.com/google/uuid v1.3.0 // indirect
34+
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
2235
github.com/jmoiron/sqlx v1.4.0 // indirect
2336
github.com/json-iterator/go v1.1.12 // indirect
2437
github.com/kelseyhightower/envconfig v1.4.0 // indirect
38+
github.com/kevinburke/ssh_config v1.2.0 // indirect
2539
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
2640
github.com/leodido/go-urn v1.4.0 // indirect
2741
github.com/lmittmann/tint v1.0.4 // indirect
2842
github.com/mattn/go-colorable v0.1.13 // indirect
2943
github.com/mattn/go-isatty v0.0.20 // indirect
3044
github.com/mattn/go-sqlite3 v1.14.22 // indirect
45+
github.com/mitchellh/go-homedir v1.1.0 // indirect
3146
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
3247
github.com/modern-go/reflect2 v1.0.2 // indirect
3348
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
49+
github.com/pjbgf/sha1cd v0.3.0 // indirect
3450
github.com/rs/zerolog v1.33.0 // indirect
3551
github.com/russross/blackfriday/v2 v2.1.0 // indirect
3652
github.com/samber/slog-gin v1.13.3 // indirect
53+
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
54+
github.com/skeema/knownhosts v1.2.2 // indirect
55+
github.com/src-d/gcfg v1.4.0 // indirect
3756
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
3857
github.com/ugorji/go/codec v1.2.12 // indirect
3958
github.com/urfave/cli v1.22.15 // indirect
4059
github.com/urfave/cli-altsrc/v3 v3.0.0-alpha2 // indirect
4160
github.com/urfave/cli/v2 v2.27.2 // indirect
4261
github.com/urfave/cli/v3 v3.0.0-alpha4 // indirect
62+
github.com/xanzy/ssh-agent v0.3.3 // indirect
4363
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 // indirect
4464
go.opentelemetry.io/otel v1.19.0 // indirect
4565
go.opentelemetry.io/otel/trace v1.19.0 // indirect
4666
golang.org/x/arch v0.8.0 // indirect
4767
golang.org/x/crypto v0.23.0 // indirect
68+
golang.org/x/mod v0.12.0 // indirect
4869
golang.org/x/net v0.25.0 // indirect
4970
golang.org/x/sys v0.20.0 // indirect
5071
golang.org/x/text v0.15.0 // indirect
72+
golang.org/x/tools v0.13.0 // indirect
5173
google.golang.org/protobuf v1.34.1 // indirect
74+
gopkg.in/src-d/go-billy.v4 v4.3.2 // indirect
75+
gopkg.in/src-d/go-git.v4 v4.13.1 // indirect
76+
gopkg.in/warnings.v0 v0.1.2 // indirect
5277
gopkg.in/yaml.v2 v2.4.0 // indirect
5378
gopkg.in/yaml.v3 v3.0.1 // indirect
5479
)

0 commit comments

Comments
 (0)