Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 2
jobs:
build-and-test:
docker:
- image: cimg/go:1.20
- image: cimg/go:1.25

environment:
BINARY_NAME: "TySug-linux-amd64"
Expand Down Expand Up @@ -34,7 +34,7 @@ jobs:
- run:
name: Lint
command: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.47.0
curl -sSfL https://golangci-lint.run/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.12.2
golangci-lint run

- run:
Expand Down Expand Up @@ -85,4 +85,4 @@ workflows:
tags:
only: /v[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
ignore: /.*/
91 changes: 57 additions & 34 deletions .golangci.toml
Original file line number Diff line number Diff line change
@@ -1,44 +1,67 @@
version = '2'

[run]
concurrency = 4
tests = false

[linters-settings]
[linters-settings.gocognit]
min-complexity = 20
[linters]
default = 'none'
enable = [
#'depguard',
'errcheck',
'exhaustive',
'gocognit',
'goconst',
'gocritic',
'gosec',
'govet',
'ineffassign',
'misspell',
'prealloc',
'staticcheck',
'unconvert',
'unparam',
'unused'
]

[linters.settings]
[linters.settings.gocognit]
min-complexity = 20

[linters-settings.gofumpt]
lang-version = "1.19"
extra-rules = true
[linters.settings.goconst]
min-len = 2
min-occurrences = 2

[linters-settings.goconst]
min-len = 2
min-occurrences = 2
[linters.settings.misspell]
locale = 'US'

[linters-settings.misspell]
locale = "US"
[linters.exclusions]
generated = 'lax'
presets = [
'comments',
'common-false-positives',
'legacy',
'std-error-handling'
]
paths = [
'third_party$',
'builtin$',
'examples$'
]

[linters]
disable-all = true
[formatters]
enable = [
"staticcheck",
"gosimple",
"ineffassign",
"typecheck",
"govet",
"errcheck",
"unused",
"exhaustive",

"stylecheck",
"gosec",
"unconvert",
"goconst",
"gocognit",
"depguard",
"misspell",
"unparam",
"prealloc",
"gofumpt",
"exportloopref",
"gocritic",
'gofumpt'
]

[formatters.settings]
[formatters.settings.gofumpt]
extra-rules = true

[formatters.exclusions]
generated = 'lax'
paths = [
'third_party$',
'builtin$',
'examples$'
]
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18 as build
FROM golang:1.25 as build

ARG VERSION="dev"
ENV GOFLAGS="-buildvcs=false"
Expand Down
1 change: 0 additions & 1 deletion cmd/web/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ func main() {
logger.Formatter = &logrus.JSONFormatter{}
logger.Out = os.Stdout
logger.Level, err = logrus.ParseLevel(config.Server.Log.Level)

if err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion finder/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func (t *Finder) FindTopRankingCtx(ctx context.Context, input string) ([]string,
// prefixLength cannot exceed length of input
func (t *Finder) FindTopRankingPrefixCtx(ctx context.Context, input string, prefixLength uint) (list []string, exact bool, err error) {
list, _, exact, err = t.findTopRankingCtx(ctx, input, prefixLength)
return
return list, exact, err
}

// getRefList returns the appropriate list of references. getRefList does not deal with locks!
Expand Down
1 change: 1 addition & 0 deletions finder/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ func FuzzMarkingTypoReplacer(f *testing.F) {
"Nothing to see ha^Here, moving along!",
"World Wide Mess^WWeb",
"When the Hare eats the ^, or when the ^Eats^WThe^WHare",
"⌘",
}

for _, tt := range tests {
Expand Down
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
module github.com/Dynom/TySug

require (
github.com/BurntSushi/toml v1.0.0
github.com/BurntSushi/toml v1.6.0
github.com/NYTimes/gziphandler v1.1.1
github.com/alextanhongpin/stringdist v0.0.1
github.com/rs/cors v1.8.2
github.com/sirupsen/logrus v1.8.1
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673
github.com/rs/cors v1.11.1
github.com/sirupsen/logrus v1.9.4
github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342
github.com/zikes/sift4 v0.0.0-20151103205100-8e89a8aebc1f
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637
)

require (
golang.org/x/net v0.0.0-20220401154927-543a649e0bdd // indirect
golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f // indirect
golang.org/x/net v0.56.0 // indirect
golang.org/x/sys v0.46.0 // indirect
)

go 1.20
go 1.25.0
31 changes: 16 additions & 15 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/BurntSushi/toml v1.0.0 h1:dtDWrepsVPfW9H/4y7dDgFc2MBUSeJhlaDtK13CxFlU=
github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk=
github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I=
github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c=
github.com/alextanhongpin/stringdist v0.0.1 h1:5Bygn3NKAoiUld8oYtoS8YplILTjOWxKe7FPAfXXs+U=
Expand All @@ -9,22 +9,23 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rs/cors v1.8.2 h1:KCooALfAYGs415Cwu5ABvv9n9509fSiG5SQJn/AQo4U=
github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA=
github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w=
github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 h1:FnBeRrxr7OU4VvAzt5X7s6266i6cSVkkFPS0TuXWbIg=
github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
github.com/zikes/sift4 v0.0.0-20151103205100-8e89a8aebc1f h1:uwsos4EwJT8IjkwPbPl78dIoouY41YQt4ocQAAKo5+o=
github.com/zikes/sift4 v0.0.0-20151103205100-8e89a8aebc1f/go.mod h1:RkT6UOQ/xx22IhYMzJoJsW3eMFc96fptPf6k/0dgncE=
golang.org/x/net v0.0.0-20220401154927-543a649e0bdd h1:zYlwaUHTmxuf6H7hwO2dgwqozQmH7zf4x+/qql4oVWc=
golang.org/x/net v0.0.0-20220401154927-543a649e0bdd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f h1:rlezHXNlxYWvBCzNses9Dlc7nGFaNMJeqLolcmQSSZY=
golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/net v0.56.0 h1:Rw8j/hFzGvJUZwNBXnAtf5sVDVt+65SK2C7IxCxZt5o=
golang.org/x/net v0.56.0/go.mod h1:D3Ku6r+V6JROoZK144D2XfMHFcMq/0zSfLelVTCFKec=
golang.org/x/sys v0.46.0 h1:noSf2Fq6F8DBgS+LysIkx7rIExoNHJsxOAtPp4rthXw=
golang.org/x/sys v0.46.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637 h1:yiW+nvdHb9LVqSHQBXfZCieqV4fzYhNBql77zY0ykqs=
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637/go.mod h1:BHsqpu/nsuzkT5BpiH1EMZPLyqSMM8JbIavyFACoFNk=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2 changes: 2 additions & 0 deletions keyboard/distance.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ func (kd KeyDist) CalculateDistance(input, ref string) float64 {

func euclideanDistance(a, b coordinates) float64 {
return math.Sqrt(
// Prevent QF1005 here.
//nolint:staticcheck
math.Pow(b.X-a.X, 2) + math.Pow(b.Y-a.Y, 2),
)
}
Expand Down