commit e5dd77a00df0eece190724bdae863b73f9920626 Author: Oleksandr Berezovskyi Date: Sun May 24 18:52:39 2026 +0300 chore: initialize Go module diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fb1e437 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +build/ +dist/ +.claude/ diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000..12dfc22 --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,131 @@ +version: "2" +linters: + enable: + - asciicheck + - bidichk + - errorlint + - forbidigo + - gocognit + - goconst + - gocritic + - makezero + - misspell + - musttag + - nestif + - nilerr + - nilnil + - nonamedreturns + - protogetter + - sloglint + - tagalign + - unconvert + - wastedassign + settings: + errcheck: + disable-default-exclusions: true + check-type-assertions: true + exclude-functions: + - (net/http.ResponseWriter).Write + - (*bytes.Buffer).Write + - File.Close + - (hash.Hash).Write + - (*database/sql.Tx).Rollback + forbidigo: + forbid: + - pattern: ^err.*\.Error.*$ + msg: please use %w to wrap errors + - pattern: ^os.LookupEnv$ + msg: do not use env vars, use command line arguments + - pattern: ^os.Getenv$ + msg: do not use env vars, use command line arguments + - pattern: ^log.Fatal$ + msg: do not use log.Fatal + - pattern: ^os.Exit$ + msg: do not use os.Exit + - pattern: ^panic$ + msg: do not use panic + - pattern: ^log\.Print + msg: use slog instead of standard log package + - pattern: ^log\.Printf + msg: use slog instead of standard log package + - pattern: ^log\.Println + msg: use slog instead of standard log package + - pattern: ^http.DefaultClient$ + msg: do not use http.DefaultClient, use a custom client instead + - pattern: ^slog.Default$ + msg: do not use slog.Default, use a custom logger instead + - pattern: ^slog.SetDefault$ + msg: do not use slog.Default, use a custom logger instead + analyze-types: true + gocritic: + disabled-checks: + - paramTypeCombine + - unnamedResult + - importShadow + - octalLiteral + enabled-tags: + - diagnostic + - style + - performance + settings: + hugeParam: + sizeThreshold: 512 + rangeValCopy: + sizeThreshold: 512 + skipTestFuncs: true + misspell: + ignore-rules: + - mosquitto + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + rules: + - linters: + - appendAssign + - errcheck + - forbidigo + - gocognit + - goconst + - gocritic + - nestif + path: _test\.go + - linters: + - forbidigo + - gocritic + path: cmd/.*/main.go + text: os.Exit + - linters: + - forbidigo + path: cmd + text: os.Getenv + - linters: + - forbidigo + path: cmd + text: slog.Default + - linters: + - forbidigo + path: cmd/.*/main.go + text: panic + paths: + - .*\.pb\.go$ + - third_party$ + - builtin$ + - examples$ +issues: + max-issues-per-linter: 0 + max-same-issues: 0 +formatters: + enable: + - gofmt + - goimports + exclusions: + generated: lax + paths: + - .*\.pb\.go$ + - third_party$ + - builtin$ + - examples$ \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..aedaf0e --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Oleksandr Berezovskyi + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..6dfa62c --- /dev/null +++ b/go.mod @@ -0,0 +1,17 @@ +module gitea.berezovskyi.dev/oleksandr/ezcoo-usb-control + +go 1.26.3 + +require ( + github.com/eclipse/paho.mqtt.golang v1.5.1 + go.bug.st/serial v1.6.4 + gopkg.in/yaml.v3 v3.0.1 +) + +require ( + github.com/creack/goselect v0.1.2 // indirect + github.com/gorilla/websocket v1.5.3 // indirect + golang.org/x/net v0.44.0 // indirect + golang.org/x/sync v0.17.0 // indirect + golang.org/x/sys v0.36.0 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..9057f97 --- /dev/null +++ b/go.sum @@ -0,0 +1,24 @@ +github.com/creack/goselect v0.1.2 h1:2DNy14+JPjRBgPzAd1thbQp4BSIihxcBf0IXhQXDRa0= +github.com/creack/goselect v0.1.2/go.mod h1:a/NhLweNvqIYMuxcMOuWY516Cimucms3DglDzQP3hKY= +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/eclipse/paho.mqtt.golang v1.5.1 h1:/VSOv3oDLlpqR2Epjn1Q7b2bSTplJIeV2ISgCl2W7nE= +github.com/eclipse/paho.mqtt.golang v1.5.1/go.mod h1:1/yJCneuyOoCOzKSsOTUc0AJfpsItBGWvYpBLimhArU= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= +github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +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/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +go.bug.st/serial v1.6.4 h1:7FmqNPgVp3pu2Jz5PoPtbZ9jJO5gnEnZIvnI1lzve8A= +go.bug.st/serial v1.6.4/go.mod h1:nofMJxTeNVny/m6+KaafC6vJGj3miwQZ6vW4BZUGJPI= +golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I= +golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY= +golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= +golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= +golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= +golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=