From 1e2eabe26a7a077d369451cea07d9dc1f1b50f76 Mon Sep 17 00:00:00 2001 From: Thomas Kohler Date: Sun, 19 Oct 2025 18:36:20 +0200 Subject: [PATCH] fmt: introduce golangci-lint and go vet using build tag --- .github/workflows/golangci-lint.yml | 34 ++ .golangci.yml | 306 ++++++++++++++++++ Makefile | 27 +- adafruit4650/device_test.go | 1 + apa102/apa102.go | 2 + apa102/softspi.go | 2 + bmi160/bmi160.go | 2 + buzzer/buzzer.go | 2 + cmd/convert2bin/convert2bin.go | 2 +- comboat/comboat.go | 2 + delay/sleep.go | 2 + easystepper/easystepper.go | 2 + espat/espat.go | 2 + espat/tcp.go | 2 + espat/wifi.go | 2 + examples/adafruit4650/main.go | 2 + examples/adt7410/main.go | 2 + examples/adxl345/main.go | 2 + examples/aht20/main.go | 2 + examples/amg88xx/main.go | 2 + examples/apa102/itsybitsy-m0/main.go | 2 + examples/apa102/main.go | 2 + examples/apds9960/color/main.go | 2 + examples/apds9960/gesture/main.go | 2 + examples/apds9960/proximity/main.go | 2 + examples/as560x/main.go | 2 + examples/at24cx/main.go | 2 + examples/axp192/m5stack-core2-blinky/main.go | 2 + examples/bh1750/main.go | 2 + examples/blinkm/main.go | 2 + examples/bma42x/main.go | 2 + examples/bme280/main.go | 2 + examples/bmi160/main.go | 2 + examples/bmp180/main.go | 2 + examples/bmp280/main.go | 2 + examples/bmp388/main.go | 2 + examples/buzzer/main.go | 2 + examples/delay/delay.go | 2 + examples/dht/main.go | 2 + examples/ds1307/sram/main.go | 2 + examples/ds1307/time/main.go | 2 + examples/ds18b20/main.go | 2 + examples/ds3231/main.go | 2 + examples/easystepper/main.go | 2 + examples/ens160/main.go | 2 + examples/flash/console/console_example.go | 2 + examples/flash/console/qspi/main.go | 2 + examples/flash/console/spi/main.go | 2 + examples/ft6336/basic/main.go | 2 + examples/ft6336/touchpaint/main.go | 2 + examples/gc9a01/main.go | 2 + examples/gps/i2c/main.go | 2 + examples/gps/uart/main.go | 2 + examples/hcsr04/main.go | 2 + examples/hd44780/customchar/main.go | 2 + examples/hd44780/text/main.go | 2 + examples/hd44780i2c/main.go | 2 + examples/hts221/main.go | 2 + examples/hub75/main.go | 2 + examples/i2csoft/adt7410/main.go | 2 + examples/ili9341/basic/main.go | 2 + examples/ili9341/pyportal_boing/main.go | 2 + examples/ili9341/scroll/main.go | 2 + examples/ili9341/slideshow/main.go | 2 + examples/ina219/main.go | 2 + examples/ina260/main.go | 2 + examples/irremote/main.go | 2 + examples/is31fl3731/main.go | 2 + examples/keypad4x4/main.go | 2 + examples/l293x/simple/main.go | 2 + examples/l293x/speed/main.go | 2 + examples/l3gd20/main.go | 2 + examples/l9110x/simple/main.go | 2 + examples/l9110x/speed/main.go | 2 + examples/lis2mdl/main.go | 2 + examples/lis3dh/main.go | 2 + examples/lora/lorawan/atcmd/commands.go | 2 + examples/lora/lorawan/atcmd/main.go | 2 + examples/lora/lorawan/atcmd/parser.go | 2 + examples/lps22hb/main.go | 2 + examples/lsm303agr/main.go | 2 + examples/lsm303dlhc/main.go | 2 + examples/lsm6ds3/main.go | 2 + examples/lsm6ds3tr/main.go | 2 + examples/lsm6dsox/main.go | 2 + examples/lsm9ds1/main.go | 2 + examples/mag3110/main.go | 2 + examples/makeybutton/main.go | 2 + examples/max6675/main.go | 2 + examples/max72xx/main.go | 2 + examples/mcp23017-multiple/main.go | 2 + examples/mcp23017/main.go | 2 + examples/mcp2515/main.go | 2 + examples/mcp3008/main.go | 2 + examples/mcp9808/main.go | 2 + examples/microbitmatrix/main.go | 2 + examples/microphone/main.go | 2 + examples/mma8653/main.go | 2 + examples/mpu6050/main.go | 2 + examples/mpu6886/main.go | 2 + examples/mpu9150/main.go | 2 + examples/ndir/main_ndir.go | 2 + examples/onewire/main.go | 2 + examples/p1am/main.go | 2 + examples/pca9685/main.go | 2 + examples/pcd8544/setbuffer/main.go | 2 + examples/pcd8544/setpixel/main.go | 2 + examples/pcf8523/main.go | 2 + examples/pcf8563/alarm/main.go | 2 + examples/pcf8563/clkout/main.go | 2 + examples/pcf8563/time/main.go | 2 + examples/pcf8563/timer/main.go | 2 + examples/pcf8591/main.go | 2 + examples/qmi8658c/main.go | 2 + examples/scd4x/main.go | 2 + examples/sdcard/console/console.go | 2 + examples/sdcard/console/main.go | 2 + examples/seesaw/rotary-encoder/main.go | 2 + examples/seesaw/soil-sensor/main.go | 2 + examples/semihosting/semihosting.go | 2 + examples/servo/servo.go | 2 + examples/sgp30/main.go | 2 + examples/sharpmem/main.go | 2 + examples/shifter/main.go | 2 + examples/shiftregister/main.go | 2 + examples/sht3x/main.go | 2 + examples/sht4x/main.go | 2 + examples/shtc3/main.go | 2 + examples/ssd1289/main.go | 2 + examples/ssd1306/main.go | 2 + examples/ssd1331/main.go | 2 + examples/ssd1351/main.go | 2 + examples/st7735/main.go | 2 + examples/st7789/main.go | 2 + .../sx126x/lora_continuous/lora_continuous.go | 2 + examples/sx126x/lora_continuous/radio.go | 2 +- examples/sx126x/lora_rxtx/lora_rxtx.go | 2 + examples/sx126x/lora_rxtx/radio.go | 2 +- examples/sx127x/lora_rxtx/lora_rxtx.go | 2 + examples/thermistor/main.go | 2 + examples/tm1637/main.go | 2 + examples/tmc2209/main.go | 2 + examples/tmc5160/main.go | 2 + examples/tmp102/main.go | 2 + examples/tone/tone.go | 2 + examples/touch/capacitive/main.go | 2 + examples/touch/resistive/fourwire/main.go | 2 + .../resistive/pyportal_touchpaint/main.go | 2 + examples/ttp229/main.go | 2 + examples/uc8151/main.go | 2 + examples/veml6070/main.go | 2 + examples/vl53l1x/main.go | 2 + examples/vl6180x/main.go | 2 + examples/waveshare-epd/epd1in54/main.go | 2 + examples/waveshare-epd/epd2in13/main.go | 2 + examples/waveshare-epd/epd2in13x/main.go | 2 + examples/waveshare-epd/epd2in66b/main.go | 2 + examples/waveshare-epd/epd2in9/main.go | 2 + examples/waveshare-epd/epd4in2/main.go | 2 + examples/ws2812/main.go | 2 + examples/ws2812/others.go | 2 +- examples/xpt2046/main.go | 2 + flash/devices.go | 2 + flash/flash.go | 2 + flash/transport_spi.go | 2 + ft6336/ft6336.go | 2 + gc9a01/gc9a01.go | 2 + gc9a01/registers.go | 2 + hcsr04/hcsr04.go | 2 + hd44780/gpio.go | 2 + hd44780/hd44780.go | 2 + hts221/hts221_generic.go | 2 - hub75/hub75.go | 2 + i2csoft/i2csoft.go | 2 + ili9341/ili9341.go | 2 + ili9341/spi.go | 2 +- image/internal/compress/flate/deflate_test.go | 2 + image/internal/compress/zlib/writer_test.go | 2 + irremote/receiver.go | 2 + keypad4x4/keypad4x4.go | 2 + l293x/l293x.go | 2 + l9110x/l9110x.go | 2 + mak.bak | 80 +++++ makeybutton/button.go | 2 + max6675/max6675.go | 2 + max72xx/max72xx.go | 2 + mcp2515/mcp2515.go | 2 + mcp3008/mcp3008.go | 2 + microbitmatrix/microbitmatrix.go | 2 + microphone/microphone.go | 2 + onewire/onewire.go | 2 + p1am/p1am.go | 2 + pcd8544/pcd8544.go | 2 + pcf8523/pcf8523.go | 1 + pcf8523/pcf8523_test.go | 1 + pcf8591/pcf8591.go | 2 + rtl8720dn/debug.go | 2 + rtl8720dn/rpc.go | 2 + rtl8720dn/rpc_util.go | 2 + rtl8720dn/rtl8720dn.go | 2 + sdcard/sdcard.go | 2 + semihosting/semihosting.go | 2 + semihosting/stdio.go | 2 + servo/servo.go | 2 + sh1106/registers.go | 2 + sh1106/sh1106.go | 2 + shifter/shifter.go | 2 + shiftregister/shiftregister.go | 2 + ssd1289/pinbus.go | 2 + ssd1289/ssd1289.go | 2 + ssd1306/ssd1306_spi.go | 2 + ssd1331/ssd1331.go | 2 + ssd1351/ssd1351.go | 2 + st7735/registers.go | 2 + st7735/st7735.go | 2 + st7789/registers.go | 2 + st7789/st7789.go | 2 + sx126x/radiocontrol_pins.go | 2 +- sx126x/sx126x.go | 2 + sx127x/radiocontrol_pins.go | 2 + sx127x/sx127x.go | 2 + thermistor/thermistor.go | 2 + tm1637/tm1637.go | 2 + tmc2209/address.go | 2 +- tone/tone.go | 2 + touch/capacitive/gpio.go | 2 + touch/resistive/fourwire.go | 2 + ttp229/ttp229.go | 2 + uc8151/registers.go | 2 + uc8151/uc8151.go | 2 + waveshare-epd/epd1in54/epd1in54.go | 2 + waveshare-epd/epd1in54/registers.go | 2 + waveshare-epd/epd2in13/epd2in13.go | 2 + waveshare-epd/epd2in13x/epd2in13x.go | 2 + waveshare-epd/epd2in13x/registers.go | 2 + waveshare-epd/epd2in66b/dev.go | 2 + waveshare-epd/epd2in66b/dev_test.go | 2 + waveshare-epd/epd2in9/epd2in9.go | 2 + waveshare-epd/epd2in9/registers.go | 2 + waveshare-epd/epd4in2/epd4in2.go | 2 + waveshare-epd/epd4in2/registers.go | 2 + wifinina/debug.go | 2 + wifinina/pins.go | 2 + wifinina/wifinina.go | 2 + ws2812/ws2812.go | 2 + ws2812/ws2812_generic.go | 2 +- xpt2046/xpt2046.go | 2 + 247 files changed, 919 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/golangci-lint.yml create mode 100644 .golangci.yml create mode 100644 mak.bak diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 000000000..e9eff15b7 --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,34 @@ +name: golangci-lint +on: + push: + tags: + - v* + branches: + - dev + pull_request: +permissions: + contents: read + # Optional: allow read access to pull request. Use with `only-new-issues` option. + # pull-requests: read +jobs: + lint: + runs-on: ubuntu-latest + name: "Lint" + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-go@v6 + with: + go-version: '1.22' + cache: false + - name: golangci-lint + uses: golangci/golangci-lint-action@v8 + with: + version: v2.5.0 + args: --build-tags=lint + + # Optional: show only new issues if it's a pull request. The default value is `false`. + # only-new-issues: true + + # Optional: if set to true then the all caching functionality will be complete disabled, + # takes precedence over all other caching options. + # skip-cache: true diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 000000000..9dad68e59 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,306 @@ +# note: GolangCI-Lint also searches for config files in all directories from the directory of the first analyzed path up to the root. +version: "2" +run: + build-tags: + - linte + + # If set we pass it to "go list -mod={option}". From "go help modules": + # If invoked with -mod=readonly, the go command is disallowed from the implicit + # automatic updating of go.mod described above. Instead, it fails when any changes + # to go.mod are needed. This setting is most useful to check that go.mod does + # not need updates, such as in a continuous integration and testing system. + # If invoked with -mod=vendor, the go command assumes that the vendor + # directory holds the correct copies of dependencies and ignores + # the dependency descriptions in go.mod. + # + # Allowed values: readonly|vendor|mod + # By default, it isn't set. + modules-download-mode: readonly + + # https://golangci-lint.run/usage/linters/#enabled-by-default + # note: typecheck can not be disabled, it is used to check code compilation +linters: + default: all + disable: + # deprecated: none + - wsl # deprecated (since v2.2.0) due to: new major version. Replaced by wsl_v5 + # not used for this go version: none + # not used for any reason + - err113 # not used (we allow error creation at return statement) + - forbidigo # not used (we allow print statements) + - ginkgolinter # not needed (enforces standards of using ginkgo and gomega) + - godot # not used (seems to be counting peas) + - godox # not used (we have many TODOs) + - gosmopolitan # not needed (report i18n/l10n anti-patterns) + - importas # not needed yet (there is no alias rule at the moment) + - loggercheck # not needed (relates to kitlog, klog, logr, zap) + - mnd # good, but very annoying when writing drivers with bit shifting etc. + - noinlineerr # this violates best practices in other style guides + - paralleltest # not used + - promlinter # not needed (prometheus metrics naming) + - rowserrcheck # not needed (sql related) + - sqlclosecheck # not needed (sql related) + - testpackage # not needed, we use the same name for test package to have access to unexposed items + - varnamelen # we love short names, if useful + - zerologlint # not needed (related to zerolog package) + # can be automatically fixed by "-fix" + - embeddedstructfieldcheck + - gocritic + - misspell + - nlreturn + # important and fast to fix ASAP + - asciicheck # never thought that the "C" in ds18b20.go:22:2 is internally the Cyrillic capital letter "ES" (U+0421) + - dupl # rarely needed, mostly a mistake, should be justified manually + - dogsled # rarely needed, mostly a mistake, should be justified manually + - exptostd # usage of experimental packages should be justified manually + - funcorder # common style + - gochecknoglobals # such global vars are needed rarely, e.g. to prevent huge heap allocations, but should be justified manually + - gochecknoinits # we should really not use it (source of hard to find bugs), a manual justification is mandatory + - govet # mostly mistakes, should be justified manually + - inamedparam # interface declarations should really have the parameters named + - ineffassign # very important - unused variables complicate code review (the reviewer often overlooks other problems) + - iotamixing # protects against mistakes + - ireturn # rarely needed, e.g. for test setups or functional options (not desirable in this repo), but should be justified manually + - noctx # how to fix can be found online + - perfsprint # will reduce count of usage of fmt-package + - predeclared # we should really not use already declared Go-identifiers for our own functions/variables + - recvcheck # simple to repair + - staticcheck # mostly simple to repair, big benefit + - thelper + - unconvert + - unused # should be fixed, because reduce bugs + - unparam # simplifies code + - wastedassign # same as "ineffassign" + # important to fix ASAP, but maybe more effort + - errcheck # very important - leads to many trouble, when errors are dropped silently + - errorlint # hard to find bugs, if error wrapping is used + - exhaustive # if we allow incomplete usage of enum switch this should be justified manually, e.g. "bma42x.go:120:2" is a valid finding + - interfacebloat # should be justified manually + - lll # 48 findings + - nakedret # should be fixed together with "nonamedreturns" (possible source of bugs) + - nonamedreturns # should be fixed, because reduce bugs + # useful for the future + - cyclop # useful (better understandable code) + - errname # useful for common style + - exhaustruct # useful in general, but for device drivers too often done by intention than a mistake + - funlen # useful (reduce bugs, simplify code, better understandable code) + - forcetypeassert # useful (prevents panic, possibility to return error instead) + - gocognit # useful (better understandable code) + - godoclint # useful, we should try it later + - goheader # useful, if we introduce a common header (e.g. for copyright) + - gosec # very important (can lead to sporadic fails), but too many findings to fix it ASAP + - intrange # introduced with go 1.22, will simplify the range syntax (opinionated) + - nestif # useful (reduce bugs, simplify code, better understandable code) + - whitespace # more common style, but could become annoying + - wrapcheck # error strings from interface methods are very poor/generic and not very helpful for debugging problems + - wsl_v5 # more common style, but could become annoying + + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - image/ + + + settings: + depguard: + # Rules to apply. + # + # Variables: + # - File Variables + # you can still use and exclamation mark ! in front of a variable to say not to use it. + # Example !$test will match any file that is not a go test file. + # + # `$all` - matches all go files + # `$test` - matches all go test files + # + # - Package Variables + # + # `$gostd` - matches all of go's standard library (Pulled from `GOROOT`) + # + # Default: Only allow $gostd in all files. + rules: + main: + # Packages that are not allowed where the value is a suggestion. + deny: + - pkg: github.com/pkg/errors + desc: Should be replaced by standard lib errors package + + dupword: + # Keywords for detecting duplicate words. + # If this list is not empty, only the words defined in this list will be detected. + # Default: [] + keywords: + - the + - and + - a + + errorlint: + # Default: true + # %v should be used by default over %w, see https://github.com/uber-go/guide/blob/master/style.md#error-wrapping + errorf: false + # Permit more than 1 %w verb, valid per Go 1.20 (Requires errorf:true) + # Default: true + errorf-multi: false + + gocritic: + disabled-checks: + - assignOp # very opinionated + - appendAssign # mostly used by intention + + nolintlint: + # Enable to require an explanation of nonzero length after each nolint directive. + # Default: false + require-explanation: true + # Enable to require nolint directives to mention the specific linter being suppressed. + # Default: false + require-specific: true + + + revive: + # Revive handles the default rules in a way that can be unexpected: + # - If there are no explicit rules, the default rules are used. + # - If there is at least one explicit rule, the default rules are not used. + # Run `GL_DEBUG=revive golangci-lint run --enable-only=revive` to see default, all available rules, and enabled rules. + # We enable all available rules and disable explicitly. + # Default: false + enable-all-rules: true + # Because revive's error description is pretty good, we can decide to activate this linter-rules instead of other linters, see the + # list at beginning of this document + rules: + - name: add-constant + disabled: true # if needed, mnd is used instead + - name: argument-limit + disabled: true # TODO: should be activated after some code is fixed/justified, maybe already covered by other linters + - name: bare-return + disabled: true # nakedret is used instead + - name: bool-literal-in-expr + disabled: true # TODO: can be activated after some code is fixed/justified + - name: cognitive-complexity + disabled: true # if needed, gocognit is used instead + - name: comment-spacings + disabled: true # will be fixed by formatters, see below + - name: confusing-naming + disabled: true # for driver development function names, which differs only by capitalization, seems to be OK + - name: confusing-results + disabled: true # TODO: should be activated after some code is fixed/justified + - name: cyclomatic + disabled: true # cyclop is used instead + - name: deep-exit + disabled: true # TODO: should be activated after some code is fixed/justified + - name: early-return + disabled: true # TODO: should be activated after some code is fixed (helps avoiding deep nested blocks) + - name: empty-block + disabled: true # TODO: should be activated after some code is fixed/justified + - name: empty-lines + disabled: true # will be fixed by formatters, see below + - name: enforce-switch-style + disabled: true # TODO: should be activated after some code is fixed (reduce hard to find bugs) + - name: error-strings + disabled: true # other linters already detect those issues + - name: exported + disabled: true # TODO: should be activated after some code is fixed (helps to find better names) + - name: flag-parameter + disabled: true # sounds useful, but when working with drivers, we often need boolean flags for some configuration + - name: function-length + disabled: true # funlen is used instead + - name: function-result-limit + arguments: [5] # 4 is often needed, e.g. for accelerometers, TODO: 5 was chosen for one finding + - name: get-return + disabled: true # TODO: should be activated after some code is fixed (helps to find better names) + - name: identical-switch-branches + disabled: true # first finding was a false positive + - name: identical-ifelseif-branches + disabled: true # first finding was a false positive, TODO: try to activate it, seems to be useful + - name: if-return + disabled: true # TODO: can be activated after some code is fixed (shorter code) + - name: increment-decrement + disabled: true # TODO: code unification, but opinionated + - name: import-shadowing + disabled: true # TODO: should be activated after some code is fixed (protects against mistakes) + - name: indent-error-flow + disabled: true # TODO: should be activated after some code is fixed (less complex code) + - name: line-length-limit + disabled: true # lll is used instead + - name: max-public-structs + disabled: true # not useful for the driver development + - name: modifies-value-receiver + disabled: true # TODO: should be activated after some code is fixed/justified (protects against mistakes) + - name: nested-structs + disabled: true # TODO: should be activated after some code is fixed/justified (less complex code) + - name: package-comments + disabled: true # TODO: can be enabled after issues are fixed + - name: package-directory-mismatch + disabled: true # TODO: should be enabled after issues are fixed/justified (ensure common golang style) + - name: range + disabled: true # TODO: can be enabled after issues are fixed (simpler code) + - name: redefines-builtin-id + disabled: true # predeclared is used instead + - name: receiver-naming + disabled: true # already covered by other linters, TODO: recheck this setting after others are enabled + - name: time-date + disabled: true # TODO: can be enabled after issues are fixed/justified + - name: unchecked-type-assertion + disabled: true # forcetypeassert is used instead + - name: unexported-naming + disabled: true # TODO: should be enabled after issues are fixed (really bad style) + - name: unexported-return + disabled: true # in most cases this is done by intention and if not, compiler errors will show the mistake + - name: unhandled-error + disabled: true # errcheck is used instead + - name: unnecessary-format + disabled: true # TODO: should be enabled after issues are fixed (helps avoiding fmt package) + - name: unnecessary-stmt + disabled: true # TODO: should be enabled after issues are fixed + - name: unused-parameter + disabled: true # TODO: "unused" is used instead, but check again after unused is activated + - name: unused-receiver + disabled: true # TODO: "unused" is used instead, but check again after unused is activated + - name: use-any + disabled: true # TODO: code unification, but opinionated + - name: use-errors-new + disabled: true # TODO: should be enabled after issues are fixed (helps avoiding fmt package) + - name: use-fmt-print + disabled: true # no, we try to avoid the fmt package, whenever possible + - name: useless-break + disabled: true # TODO: should be enabled after issues are fixed, but only one of this or "unnecessary-stmt" is needed + - name: useless-fallthrough + disabled: true # TODO: should be enabled after issues are fixed + - name: var-declaration + disabled: true # already covered by other linters + - name: var-naming + disabled: true # TODO: maybe better by manual justification + + +formatters: + enable: + # TODO: can be automatically fixed by "-fix" + #- gci + #- gofmt + #- gofumpt + - goimports + + exclusions: + generated: lax + + settings: + gci: + # Section configuration to compare against. + # Section names are case-insensitive and may contain parameters in (). + # The default order of sections is `standard > default > custom > blank > dot`, + # If `custom-order` is `true`, it follows the order of `sections` option. + # Default: ["standard", "default"] + sections: + - standard # Standard section: captures all standard packages. + - default # Default section: contains all imports that could not be matched to another section type. + - prefix(tinygo.org/x/drivers/) # Custom section: groups all imports with the specified Prefix. + #- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled. + #- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled. + # Enable custom order of sections. + # If `true`, make the section order the same as the order of `sections`. + # Default: false + custom-order: true diff --git a/Makefile b/Makefile index c05ef645b..53df4ccc1 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,3 @@ - clean: @rm -rf build @@ -26,3 +25,29 @@ unit-test: @go test -v $(addprefix ./,$(TESTS)) test: clean fmt-check unit-test smoke-test + +fmt_quick_check: + @# a very fast check before build, but depends on accessibility of all imports + @# switch off the "stdmethods" analyzer is needed due to finding: + @# at24cx/at24cx.go:57:18: method WriteByte(eepromAddress uint16, value uint8) error should have signature WriteByte(byte) error + @# at24cx/at24cx.go:67:18: method ReadByte(eepromAddress uint16) (uint8, error) should have signature ReadByte() (byte, error) + @# switch off the "shift" analyzer is needed due to finding: + @#tmc5160/registers.go:1939:16: m.CUR_A (16 bits) too small for shift of 16 + @#tmc5160/registers.go:1996:16: m.X3 (8 bits) too small for shift of 27 + @#tmc5160/registers.go:1996:27: m.X2 (8 bits) too small for shift of 24 + @#tmc5160/registers.go:1996:38: m.X1 (8 bits) too small for shift of 21 + @#tmc5160/registers.go:1996:49: m.W3 (8 bits) too small for shift of 18 + @#tmc5160/registers.go:1996:60: m.W2 (8 bits) too small for shift of 16 + @#tmc5160/registers.go:1996:71: m.W1 (8 bits) too small for shift of 14 + @#tmc5160/registers.go:1996:82: m.W0 (8 bits) too small for shift of 12 + go vet -tags lint -stdmethods=false -shift=false ./... + +fmt_check: + @# a complete format check, but depends on accessibility of all imports + golangci-lint run --build-tags=lint + +fmt_fix: + @# an automatic reformat and complete format check, but depends on accessibility of all imports + @#TODO: activate when ready + @#gofumpt -l -w ./... + golangci-lint -v run --build-tags=lint --fix diff --git a/adafruit4650/device_test.go b/adafruit4650/device_test.go index 9cf56f939..fffcdb230 100644 --- a/adafruit4650/device_test.go +++ b/adafruit4650/device_test.go @@ -12,6 +12,7 @@ import ( "os" "testing" "time" + "tinygo.org/x/drivers" "tinygo.org/x/tinyfont" "tinygo.org/x/tinyfont/freemono" diff --git a/apa102/apa102.go b/apa102/apa102.go index 98253bfdf..1290c1ffc 100644 --- a/apa102/apa102.go +++ b/apa102/apa102.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package apa102 implements a driver for the APA102 SPI LED. // // Datasheet: https://cdn-shop.adafruit.com/product-files/2343/APA102C.pdf diff --git a/apa102/softspi.go b/apa102/softspi.go index 89e8a8587..0d8bc08bc 100644 --- a/apa102/softspi.go +++ b/apa102/softspi.go @@ -1,3 +1,5 @@ +//go:build !lint + package apa102 import "machine" diff --git a/bmi160/bmi160.go b/bmi160/bmi160.go index cd3e88237..76cd98de5 100644 --- a/bmi160/bmi160.go +++ b/bmi160/bmi160.go @@ -1,3 +1,5 @@ +//go:build !lint + package bmi160 import ( diff --git a/buzzer/buzzer.go b/buzzer/buzzer.go index 04c112953..abacf706e 100644 --- a/buzzer/buzzer.go +++ b/buzzer/buzzer.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package buzzer provides a very simplistic driver for a connected buzzer or low-fidelity speaker. package buzzer // import "tinygo.org/x/drivers/buzzer" diff --git a/cmd/convert2bin/convert2bin.go b/cmd/convert2bin/convert2bin.go index c7cfaa1f8..620d0acfe 100644 --- a/cmd/convert2bin/convert2bin.go +++ b/cmd/convert2bin/convert2bin.go @@ -19,7 +19,7 @@ func main() { func run(args []string) error { if len(args) < 2 { - return fmt.Errorf("usage: %s FILE") + return fmt.Errorf("usage: %s FILE", args[0]) } b, err := ioutil.ReadFile(args[1]) diff --git a/comboat/comboat.go b/comboat/comboat.go index 2687c367c..349c262da 100644 --- a/comboat/comboat.go +++ b/comboat/comboat.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package comboat implements WiFi driver for the Aithinker-Combo-AT WiFi // device found on the Elecrow W5 rp2040 and rp2350 devices. Ths WiFi device // is a RTL8720d variant. The driver interface is via AT command set over UART diff --git a/delay/sleep.go b/delay/sleep.go index 3510dd04c..985fcc911 100644 --- a/delay/sleep.go +++ b/delay/sleep.go @@ -1,3 +1,5 @@ +//go:build !lint + package delay import ( diff --git a/easystepper/easystepper.go b/easystepper/easystepper.go index b6b93f830..febc63092 100644 --- a/easystepper/easystepper.go +++ b/easystepper/easystepper.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package easystepper provides a simple driver to rotate a 4-wire stepper motor. package easystepper // import "tinygo.org/x/drivers/easystepper" diff --git a/espat/espat.go b/espat/espat.go index 7696e34c2..667601f91 100644 --- a/espat/espat.go +++ b/espat/espat.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package espat implements TCP/UDP wireless communication over serial // with a separate ESP8266 or ESP32 board using the Espressif AT command set // across a UART interface. diff --git a/espat/tcp.go b/espat/tcp.go index 9c8524d9a..892ac798b 100644 --- a/espat/tcp.go +++ b/espat/tcp.go @@ -1,3 +1,5 @@ +//go:build !lint + package espat import ( diff --git a/espat/wifi.go b/espat/wifi.go index 808cc0762..4c8091616 100644 --- a/espat/wifi.go +++ b/espat/wifi.go @@ -1,3 +1,5 @@ +//go:build !lint + package espat import ( diff --git a/examples/adafruit4650/main.go b/examples/adafruit4650/main.go index 074b65947..15d785d36 100644 --- a/examples/adafruit4650/main.go +++ b/examples/adafruit4650/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/adt7410/main.go b/examples/adt7410/main.go index 132b77b6b..13d7680a4 100644 --- a/examples/adt7410/main.go +++ b/examples/adt7410/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/adxl345/main.go b/examples/adxl345/main.go index d8909d736..4231a4431 100644 --- a/examples/adxl345/main.go +++ b/examples/adxl345/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/aht20/main.go b/examples/aht20/main.go index e1db3b01c..df8a46f88 100644 --- a/examples/aht20/main.go +++ b/examples/aht20/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/amg88xx/main.go b/examples/amg88xx/main.go index 65f715822..3292fe6a7 100644 --- a/examples/amg88xx/main.go +++ b/examples/amg88xx/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/apa102/itsybitsy-m0/main.go b/examples/apa102/itsybitsy-m0/main.go index ac6d8c608..4249f5eeb 100644 --- a/examples/apa102/itsybitsy-m0/main.go +++ b/examples/apa102/itsybitsy-m0/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // This example demostrates how to control the "Dotstar" (APA102) LED included // on the Adafruit Itsy Bitsy M0 board. It implements a "rainbow effect" based // on the following example: diff --git a/examples/apa102/main.go b/examples/apa102/main.go index 3740c24f8..8e797cfa0 100644 --- a/examples/apa102/main.go +++ b/examples/apa102/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // Connects to an APA102 SPI RGB LED strip with 30 LEDS. package main diff --git a/examples/apds9960/color/main.go b/examples/apds9960/color/main.go index b9b566467..fd42f5a86 100644 --- a/examples/apds9960/color/main.go +++ b/examples/apds9960/color/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/apds9960/gesture/main.go b/examples/apds9960/gesture/main.go index 8e11f5919..dbe7e8393 100644 --- a/examples/apds9960/gesture/main.go +++ b/examples/apds9960/gesture/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/apds9960/proximity/main.go b/examples/apds9960/proximity/main.go index 8428a573a..141cec360 100644 --- a/examples/apds9960/proximity/main.go +++ b/examples/apds9960/proximity/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/as560x/main.go b/examples/as560x/main.go index c20e25482..b5893a2a8 100644 --- a/examples/as560x/main.go +++ b/examples/as560x/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/at24cx/main.go b/examples/at24cx/main.go index d23f5d1fb..ba8507020 100644 --- a/examples/at24cx/main.go +++ b/examples/at24cx/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/axp192/m5stack-core2-blinky/main.go b/examples/axp192/m5stack-core2-blinky/main.go index d77faee72..2500d4d72 100644 --- a/examples/axp192/m5stack-core2-blinky/main.go +++ b/examples/axp192/m5stack-core2-blinky/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/bh1750/main.go b/examples/bh1750/main.go index 3ff164b88..16270cbf5 100644 --- a/examples/bh1750/main.go +++ b/examples/bh1750/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/blinkm/main.go b/examples/blinkm/main.go index b9815ff34..e4fbcee09 100644 --- a/examples/blinkm/main.go +++ b/examples/blinkm/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // Connects to an BlinkM I2C RGB LED. // http://thingm.com/fileadmin/thingm/downloads/BlinkM_datasheet.pdf package main diff --git a/examples/bma42x/main.go b/examples/bma42x/main.go index 8f0b4a0f3..509b283e9 100644 --- a/examples/bma42x/main.go +++ b/examples/bma42x/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main // Smoke test for the BMA421/BMA425 sensors. diff --git a/examples/bme280/main.go b/examples/bme280/main.go index 3b7d33357..bd24cb48d 100644 --- a/examples/bme280/main.go +++ b/examples/bme280/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/bmi160/main.go b/examples/bmi160/main.go index 364fef751..a025a397b 100644 --- a/examples/bmi160/main.go +++ b/examples/bmi160/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/bmp180/main.go b/examples/bmp180/main.go index b20e0a36f..b4d74bfde 100644 --- a/examples/bmp180/main.go +++ b/examples/bmp180/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/bmp280/main.go b/examples/bmp280/main.go index b88d2ba76..b96df61b7 100644 --- a/examples/bmp280/main.go +++ b/examples/bmp280/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/bmp388/main.go b/examples/bmp388/main.go index 06bc9e212..a64d20dee 100644 --- a/examples/bmp388/main.go +++ b/examples/bmp388/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/buzzer/main.go b/examples/buzzer/main.go index 268a10351..98e3635b4 100644 --- a/examples/buzzer/main.go +++ b/examples/buzzer/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/delay/delay.go b/examples/delay/delay.go index 00f57772b..62c40c472 100644 --- a/examples/delay/delay.go +++ b/examples/delay/delay.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/dht/main.go b/examples/dht/main.go index 151258bf7..de0aa050d 100644 --- a/examples/dht/main.go +++ b/examples/dht/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/ds1307/sram/main.go b/examples/ds1307/sram/main.go index 020de9e6f..00731ef2e 100644 --- a/examples/ds1307/sram/main.go +++ b/examples/ds1307/sram/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/ds1307/time/main.go b/examples/ds1307/time/main.go index 691b41d6b..cf647d00f 100644 --- a/examples/ds1307/time/main.go +++ b/examples/ds1307/time/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/ds18b20/main.go b/examples/ds18b20/main.go index ae45a78ba..431c22bcc 100644 --- a/examples/ds18b20/main.go +++ b/examples/ds18b20/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/ds3231/main.go b/examples/ds3231/main.go index 08ec468e6..784c2b8eb 100644 --- a/examples/ds3231/main.go +++ b/examples/ds3231/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // Connects to an DS3231 I2C Real Time Clock (RTC). package main diff --git a/examples/easystepper/main.go b/examples/easystepper/main.go index 9a60a6ebc..7569a502e 100644 --- a/examples/easystepper/main.go +++ b/examples/easystepper/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/ens160/main.go b/examples/ens160/main.go index d3571601d..6103b18ca 100644 --- a/examples/ens160/main.go +++ b/examples/ens160/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // This example demonstrates ENS160 usage. // // Wiring: diff --git a/examples/flash/console/console_example.go b/examples/flash/console/console_example.go index c6f6544a0..8a939775d 100644 --- a/examples/flash/console/console_example.go +++ b/examples/flash/console/console_example.go @@ -1,3 +1,5 @@ +//go:build !lint + package console_example import ( diff --git a/examples/flash/console/qspi/main.go b/examples/flash/console/qspi/main.go index 6a71931e3..d48fc442a 100644 --- a/examples/flash/console/qspi/main.go +++ b/examples/flash/console/qspi/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/flash/console/spi/main.go b/examples/flash/console/spi/main.go index 5d28fa77b..8c1e1679b 100644 --- a/examples/flash/console/spi/main.go +++ b/examples/flash/console/spi/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/ft6336/basic/main.go b/examples/ft6336/basic/main.go index a421ec72b..871ace345 100644 --- a/examples/ft6336/basic/main.go +++ b/examples/ft6336/basic/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main func main() { diff --git a/examples/ft6336/touchpaint/main.go b/examples/ft6336/touchpaint/main.go index 35dfe59d1..0c9840207 100644 --- a/examples/ft6336/touchpaint/main.go +++ b/examples/ft6336/touchpaint/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/gc9a01/main.go b/examples/gc9a01/main.go index a5883fb66..c3637a244 100644 --- a/examples/gc9a01/main.go +++ b/examples/gc9a01/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/gps/i2c/main.go b/examples/gps/i2c/main.go index 123cc261a..9b2a013bb 100644 --- a/examples/gps/i2c/main.go +++ b/examples/gps/i2c/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/gps/uart/main.go b/examples/gps/uart/main.go index 7e6a2c448..56b3651f8 100644 --- a/examples/gps/uart/main.go +++ b/examples/gps/uart/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/hcsr04/main.go b/examples/hcsr04/main.go index 191bc0709..d4f7a2d6f 100644 --- a/examples/hcsr04/main.go +++ b/examples/hcsr04/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/hd44780/customchar/main.go b/examples/hd44780/customchar/main.go index 6be0df54f..aaa74ffd4 100644 --- a/examples/hd44780/customchar/main.go +++ b/examples/hd44780/customchar/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/hd44780/text/main.go b/examples/hd44780/text/main.go index 9f8806eba..e716c54f6 100644 --- a/examples/hd44780/text/main.go +++ b/examples/hd44780/text/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/hd44780i2c/main.go b/examples/hd44780i2c/main.go index 1675275d0..2ce635f10 100644 --- a/examples/hd44780i2c/main.go +++ b/examples/hd44780i2c/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/hts221/main.go b/examples/hts221/main.go index 679432fbb..14261124d 100644 --- a/examples/hts221/main.go +++ b/examples/hts221/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/hub75/main.go b/examples/hub75/main.go index 2560faa81..6b19c4cf2 100644 --- a/examples/hub75/main.go +++ b/examples/hub75/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/i2csoft/adt7410/main.go b/examples/i2csoft/adt7410/main.go index 30b294dc5..7137f52b5 100644 --- a/examples/i2csoft/adt7410/main.go +++ b/examples/i2csoft/adt7410/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/ili9341/basic/main.go b/examples/ili9341/basic/main.go index 30b98552f..7e9869010 100644 --- a/examples/ili9341/basic/main.go +++ b/examples/ili9341/basic/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/ili9341/pyportal_boing/main.go b/examples/ili9341/pyportal_boing/main.go index b03423386..cef518b5b 100644 --- a/examples/ili9341/pyportal_boing/main.go +++ b/examples/ili9341/pyportal_boing/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // Port of Adafruit's "pyportal_boing" demo found here: // https://github.com/adafruit/Adafruit_ILI9341/blob/master/examples/pyportal_boing package main diff --git a/examples/ili9341/scroll/main.go b/examples/ili9341/scroll/main.go index 80282d98c..9f40d666b 100644 --- a/examples/ili9341/scroll/main.go +++ b/examples/ili9341/scroll/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/ili9341/slideshow/main.go b/examples/ili9341/slideshow/main.go index 6e30afe99..077a8577e 100644 --- a/examples/ili9341/slideshow/main.go +++ b/examples/ili9341/slideshow/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/ina219/main.go b/examples/ina219/main.go index 50fcba20a..e0f0a4b77 100644 --- a/examples/ina219/main.go +++ b/examples/ina219/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/ina260/main.go b/examples/ina260/main.go index 8153a1332..f92e5963a 100644 --- a/examples/ina260/main.go +++ b/examples/ina260/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/irremote/main.go b/examples/irremote/main.go index 3ee1ec33b..bfcdedb24 100644 --- a/examples/irremote/main.go +++ b/examples/irremote/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/is31fl3731/main.go b/examples/is31fl3731/main.go index 7525c8e1b..fb8c49dde 100644 --- a/examples/is31fl3731/main.go +++ b/examples/is31fl3731/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/keypad4x4/main.go b/examples/keypad4x4/main.go index e02215c04..af0219418 100644 --- a/examples/keypad4x4/main.go +++ b/examples/keypad4x4/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/l293x/simple/main.go b/examples/l293x/simple/main.go index e253a7c21..e2e3f0716 100644 --- a/examples/l293x/simple/main.go +++ b/examples/l293x/simple/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/l293x/speed/main.go b/examples/l293x/speed/main.go index cf532ff01..a21b09eae 100644 --- a/examples/l293x/speed/main.go +++ b/examples/l293x/speed/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/l3gd20/main.go b/examples/l3gd20/main.go index 5536c4056..752448276 100644 --- a/examples/l3gd20/main.go +++ b/examples/l3gd20/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/l9110x/simple/main.go b/examples/l9110x/simple/main.go index 76e69b74a..ce986ad68 100644 --- a/examples/l9110x/simple/main.go +++ b/examples/l9110x/simple/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/l9110x/speed/main.go b/examples/l9110x/speed/main.go index b2ed9b856..7ffe89bfc 100644 --- a/examples/l9110x/speed/main.go +++ b/examples/l9110x/speed/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/lis2mdl/main.go b/examples/lis2mdl/main.go index 55601fc00..1ef3b147d 100644 --- a/examples/lis2mdl/main.go +++ b/examples/lis2mdl/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/lis3dh/main.go b/examples/lis3dh/main.go index cab970e2a..0e69d7026 100644 --- a/examples/lis3dh/main.go +++ b/examples/lis3dh/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // Connects to a LIS3DH I2C accelerometer on the Adafruit Circuit Playground Express. package main diff --git a/examples/lora/lorawan/atcmd/commands.go b/examples/lora/lorawan/atcmd/commands.go index 0afede745..485c01499 100644 --- a/examples/lora/lorawan/atcmd/commands.go +++ b/examples/lora/lorawan/atcmd/commands.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/lora/lorawan/atcmd/main.go b/examples/lora/lorawan/atcmd/main.go index 2b84ff599..d3473a78e 100644 --- a/examples/lora/lorawan/atcmd/main.go +++ b/examples/lora/lorawan/atcmd/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // AT command set console running on the device UART to communicate with // an attached LoRa device. // diff --git a/examples/lora/lorawan/atcmd/parser.go b/examples/lora/lorawan/atcmd/parser.go index 8dc9dcf47..6d67b0bc2 100644 --- a/examples/lora/lorawan/atcmd/parser.go +++ b/examples/lora/lorawan/atcmd/parser.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/lps22hb/main.go b/examples/lps22hb/main.go index 743a648f1..c3e58cb96 100644 --- a/examples/lps22hb/main.go +++ b/examples/lps22hb/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/lsm303agr/main.go b/examples/lsm303agr/main.go index fadb1dc1c..b0af7bccf 100644 --- a/examples/lsm303agr/main.go +++ b/examples/lsm303agr/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/lsm303dlhc/main.go b/examples/lsm303dlhc/main.go index 9e27eaffc..130a6eb5d 100644 --- a/examples/lsm303dlhc/main.go +++ b/examples/lsm303dlhc/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/lsm6ds3/main.go b/examples/lsm6ds3/main.go index 1cee5fad5..ea2c5ef39 100644 --- a/examples/lsm6ds3/main.go +++ b/examples/lsm6ds3/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // Connects to an LSM6DS3 I2C a 6 axis Inertial Measurement Unit (IMU) package main diff --git a/examples/lsm6ds3tr/main.go b/examples/lsm6ds3tr/main.go index f717e3d3f..1a5282d13 100644 --- a/examples/lsm6ds3tr/main.go +++ b/examples/lsm6ds3tr/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // Connects to an LSM6DS3TR I2C a 6 axis Inertial Measurement Unit (IMU) package main diff --git a/examples/lsm6dsox/main.go b/examples/lsm6dsox/main.go index cc521aa44..eee0021a3 100644 --- a/examples/lsm6dsox/main.go +++ b/examples/lsm6dsox/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // Connects to an LSM6DSOX I2C a 6 axis Inertial Measurement Unit (IMU) package main diff --git a/examples/lsm9ds1/main.go b/examples/lsm9ds1/main.go index 6c0aef471..eb047193a 100644 --- a/examples/lsm9ds1/main.go +++ b/examples/lsm9ds1/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // LSM9DS1, 9 axis Inertial Measurement Unit (IMU) package main diff --git a/examples/mag3110/main.go b/examples/mag3110/main.go index 34f12ae97..410633ec0 100644 --- a/examples/mag3110/main.go +++ b/examples/mag3110/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // Connects to an MAG3110 I2C magnetometer. package main diff --git a/examples/makeybutton/main.go b/examples/makeybutton/main.go index d92ff80ef..9805a3a03 100644 --- a/examples/makeybutton/main.go +++ b/examples/makeybutton/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/max6675/main.go b/examples/max6675/main.go index b5830888b..01e013fbd 100644 --- a/examples/max6675/main.go +++ b/examples/max6675/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/max72xx/main.go b/examples/max72xx/main.go index 1c8243c39..92ebc6390 100644 --- a/examples/max72xx/main.go +++ b/examples/max72xx/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/mcp23017-multiple/main.go b/examples/mcp23017-multiple/main.go index 14884c848..1fdc6b257 100644 --- a/examples/mcp23017-multiple/main.go +++ b/examples/mcp23017-multiple/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // This example demonstrates putting several mcp23017 devices together into // a single virtual I/O array. package main diff --git a/examples/mcp23017/main.go b/examples/mcp23017/main.go index 93354bea1..bfa848d30 100644 --- a/examples/mcp23017/main.go +++ b/examples/mcp23017/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/mcp2515/main.go b/examples/mcp2515/main.go index 6b7a84f1a..ac4a45ec3 100644 --- a/examples/mcp2515/main.go +++ b/examples/mcp2515/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/mcp3008/main.go b/examples/mcp3008/main.go index fdef3c7bf..b4d344feb 100644 --- a/examples/mcp3008/main.go +++ b/examples/mcp3008/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // Connects to a MCP3008 ADC via SPI. package main diff --git a/examples/mcp9808/main.go b/examples/mcp9808/main.go index 7b2c5eabe..e31b92a2c 100644 --- a/examples/mcp9808/main.go +++ b/examples/mcp9808/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/microbitmatrix/main.go b/examples/microbitmatrix/main.go index 1b05a9ee4..3f02a030c 100644 --- a/examples/microbitmatrix/main.go +++ b/examples/microbitmatrix/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/microphone/main.go b/examples/microphone/main.go index 15c46627e..d5329c274 100644 --- a/examples/microphone/main.go +++ b/examples/microphone/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // Example using the i2s hardware interface on the Adafruit Circuit Playground Express // to read data from the onboard MEMS microphone. // diff --git a/examples/mma8653/main.go b/examples/mma8653/main.go index 8b5212989..4971525d9 100644 --- a/examples/mma8653/main.go +++ b/examples/mma8653/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // Connects to an MMA8653 I2C accelerometer. package main diff --git a/examples/mpu6050/main.go b/examples/mpu6050/main.go index 90c224039..967f07de2 100644 --- a/examples/mpu6050/main.go +++ b/examples/mpu6050/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // Connects to an MPU6050 I2C accelerometer/gyroscope. package main diff --git a/examples/mpu6886/main.go b/examples/mpu6886/main.go index b369a9a7a..8a20dba04 100644 --- a/examples/mpu6886/main.go +++ b/examples/mpu6886/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // Connects to an MPU6886 I2C accelerometer/gyroscope. package main diff --git a/examples/mpu9150/main.go b/examples/mpu9150/main.go index 42a86b14e..6194a0ac4 100644 --- a/examples/mpu9150/main.go +++ b/examples/mpu9150/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // Connects to an MPU9150 I2C accelerometer/gyroscope. package main diff --git a/examples/ndir/main_ndir.go b/examples/ndir/main_ndir.go index 9cd590d8d..572803b1b 100644 --- a/examples/ndir/main_ndir.go +++ b/examples/ndir/main_ndir.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/onewire/main.go b/examples/onewire/main.go index 6322b84ac..3867b3949 100644 --- a/examples/onewire/main.go +++ b/examples/onewire/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/p1am/main.go b/examples/p1am/main.go index 6fe18ae49..3bf2668f6 100644 --- a/examples/p1am/main.go +++ b/examples/p1am/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/pca9685/main.go b/examples/pca9685/main.go index c47c03862..779a91f4a 100644 --- a/examples/pca9685/main.go +++ b/examples/pca9685/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/pcd8544/setbuffer/main.go b/examples/pcd8544/setbuffer/main.go index 9eba0c1e3..e4d57900f 100644 --- a/examples/pcd8544/setbuffer/main.go +++ b/examples/pcd8544/setbuffer/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/pcd8544/setpixel/main.go b/examples/pcd8544/setpixel/main.go index 18aa369d6..e454802ef 100644 --- a/examples/pcd8544/setpixel/main.go +++ b/examples/pcd8544/setpixel/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/pcf8523/main.go b/examples/pcf8523/main.go index 2d416b0e7..060ae1bd7 100644 --- a/examples/pcf8523/main.go +++ b/examples/pcf8523/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/pcf8563/alarm/main.go b/examples/pcf8563/alarm/main.go index c932bef3c..8703acc2f 100644 --- a/examples/pcf8563/alarm/main.go +++ b/examples/pcf8563/alarm/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/pcf8563/clkout/main.go b/examples/pcf8563/clkout/main.go index 62037b701..e659fb877 100644 --- a/examples/pcf8563/clkout/main.go +++ b/examples/pcf8563/clkout/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/pcf8563/time/main.go b/examples/pcf8563/time/main.go index 9f1e1b363..7ab1d0fb4 100644 --- a/examples/pcf8563/time/main.go +++ b/examples/pcf8563/time/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/pcf8563/timer/main.go b/examples/pcf8563/timer/main.go index 0f9c27f03..3932f036a 100644 --- a/examples/pcf8563/timer/main.go +++ b/examples/pcf8563/timer/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/pcf8591/main.go b/examples/pcf8591/main.go index 39942242f..08fbfc2ae 100644 --- a/examples/pcf8591/main.go +++ b/examples/pcf8591/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // Connects to a pcf8591 ADC via I2C. package main diff --git a/examples/qmi8658c/main.go b/examples/qmi8658c/main.go index 667fe43f8..a89220517 100644 --- a/examples/qmi8658c/main.go +++ b/examples/qmi8658c/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // Connects to an QMI8658C I2C accelerometer/gyroscope and print the read data. // This example was made with the "WaveShare RP2040 Round LCD 1.28in" in mind. // For more infor about this development board: diff --git a/examples/scd4x/main.go b/examples/scd4x/main.go index 39c1ef7a6..476ba56b9 100644 --- a/examples/scd4x/main.go +++ b/examples/scd4x/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/sdcard/console/console.go b/examples/sdcard/console/console.go index 0960afa51..a914f160f 100644 --- a/examples/sdcard/console/console.go +++ b/examples/sdcard/console/console.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/sdcard/console/main.go b/examples/sdcard/console/main.go index 7f3cdeeed..3c7cfd633 100644 --- a/examples/sdcard/console/main.go +++ b/examples/sdcard/console/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/seesaw/rotary-encoder/main.go b/examples/seesaw/rotary-encoder/main.go index fcd4571a8..3b0ff46ea 100644 --- a/examples/seesaw/rotary-encoder/main.go +++ b/examples/seesaw/rotary-encoder/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/seesaw/soil-sensor/main.go b/examples/seesaw/soil-sensor/main.go index 95472d21e..ba013189e 100644 --- a/examples/seesaw/soil-sensor/main.go +++ b/examples/seesaw/soil-sensor/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/semihosting/semihosting.go b/examples/semihosting/semihosting.go index d3a6611ec..559bcb22d 100644 --- a/examples/semihosting/semihosting.go +++ b/examples/semihosting/semihosting.go @@ -1,3 +1,5 @@ +//go:build !lint + package main // A small example that demonstrates how SemiHosting can be used. diff --git a/examples/servo/servo.go b/examples/servo/servo.go index a38d25d27..64dd3d249 100644 --- a/examples/servo/servo.go +++ b/examples/servo/servo.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/sgp30/main.go b/examples/sgp30/main.go index bf586b6a7..0306c7a39 100644 --- a/examples/sgp30/main.go +++ b/examples/sgp30/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main // Example for the SGP30 to be used on a Raspberry Pi pico. diff --git a/examples/sharpmem/main.go b/examples/sharpmem/main.go index 2a3f2d728..215a0f344 100644 --- a/examples/sharpmem/main.go +++ b/examples/sharpmem/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/shifter/main.go b/examples/shifter/main.go index 338676d20..8a048dd08 100644 --- a/examples/shifter/main.go +++ b/examples/shifter/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // This example is designed to implement the button shifter for a PyBadge. package main diff --git a/examples/shiftregister/main.go b/examples/shiftregister/main.go index 9ab8515d6..d257aa82b 100644 --- a/examples/shiftregister/main.go +++ b/examples/shiftregister/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/sht3x/main.go b/examples/sht3x/main.go index 145f424f9..4edd2f4b0 100644 --- a/examples/sht3x/main.go +++ b/examples/sht3x/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/sht4x/main.go b/examples/sht4x/main.go index 05760b39d..82b0034ba 100644 --- a/examples/sht4x/main.go +++ b/examples/sht4x/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/shtc3/main.go b/examples/shtc3/main.go index ce752f829..f9fbca0dd 100644 --- a/examples/shtc3/main.go +++ b/examples/shtc3/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/ssd1289/main.go b/examples/ssd1289/main.go index c68f328df..e826f18c9 100644 --- a/examples/ssd1289/main.go +++ b/examples/ssd1289/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/ssd1306/main.go b/examples/ssd1306/main.go index a7f412d48..128c4ceab 100644 --- a/examples/ssd1306/main.go +++ b/examples/ssd1306/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main // This example shows how to use SSD1306 OLED display driver over I2C and SPI. diff --git a/examples/ssd1331/main.go b/examples/ssd1331/main.go index 40877f83d..523a27f10 100644 --- a/examples/ssd1331/main.go +++ b/examples/ssd1331/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/ssd1351/main.go b/examples/ssd1351/main.go index b1274ad2a..c1f089164 100644 --- a/examples/ssd1351/main.go +++ b/examples/ssd1351/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/st7735/main.go b/examples/st7735/main.go index 141eea506..15d3c48b1 100644 --- a/examples/st7735/main.go +++ b/examples/st7735/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/st7789/main.go b/examples/st7789/main.go index 48532d871..a343b609a 100644 --- a/examples/st7789/main.go +++ b/examples/st7789/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/sx126x/lora_continuous/lora_continuous.go b/examples/sx126x/lora_continuous/lora_continuous.go index 03d9c5047..592ff15f0 100644 --- a/examples/sx126x/lora_continuous/lora_continuous.go +++ b/examples/sx126x/lora_continuous/lora_continuous.go @@ -1,3 +1,5 @@ +//go:build !lint + package main // This example will periodically enable Continuous "Preamble" and "Wave" modes on 868.1 Mhz diff --git a/examples/sx126x/lora_continuous/radio.go b/examples/sx126x/lora_continuous/radio.go index 865702621..62b588093 100644 --- a/examples/sx126x/lora_continuous/radio.go +++ b/examples/sx126x/lora_continuous/radio.go @@ -1,4 +1,4 @@ -//go:build !stm32wlx +//go:build !stm32wlx && !lint package main diff --git a/examples/sx126x/lora_rxtx/lora_rxtx.go b/examples/sx126x/lora_rxtx/lora_rxtx.go index c3e238e9f..b8cc7eec8 100644 --- a/examples/sx126x/lora_rxtx/lora_rxtx.go +++ b/examples/sx126x/lora_rxtx/lora_rxtx.go @@ -1,3 +1,5 @@ +//go:build !lint + package main // In this example, a Lora packet will be sent every 10s diff --git a/examples/sx126x/lora_rxtx/radio.go b/examples/sx126x/lora_rxtx/radio.go index 02a1f2434..052532eae 100644 --- a/examples/sx126x/lora_rxtx/radio.go +++ b/examples/sx126x/lora_rxtx/radio.go @@ -1,4 +1,4 @@ -//go:build !stm32wlx +//go:build !stm32wlx && !lint package main diff --git a/examples/sx127x/lora_rxtx/lora_rxtx.go b/examples/sx127x/lora_rxtx/lora_rxtx.go index 7d834caee..2128ff7b1 100644 --- a/examples/sx127x/lora_rxtx/lora_rxtx.go +++ b/examples/sx127x/lora_rxtx/lora_rxtx.go @@ -1,3 +1,5 @@ +//go:build !lint + package main // This example code demonstrates Lora RX/TX With SX127x driver diff --git a/examples/thermistor/main.go b/examples/thermistor/main.go index 0326d20d9..c026b6604 100644 --- a/examples/thermistor/main.go +++ b/examples/thermistor/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // This example uses the settings for the thermistor that is built in to the // Adafruit Circuit Playground Express. package main diff --git a/examples/tm1637/main.go b/examples/tm1637/main.go index 9a131a11a..be9c6fddc 100644 --- a/examples/tm1637/main.go +++ b/examples/tm1637/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/tmc2209/main.go b/examples/tmc2209/main.go index fdb74ba9e..09fa69b06 100644 --- a/examples/tmc2209/main.go +++ b/examples/tmc2209/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/tmc5160/main.go b/examples/tmc5160/main.go index 3b60ccf1b..78bea2caa 100644 --- a/examples/tmc5160/main.go +++ b/examples/tmc5160/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // Connects to SPI1 on a RP2040 (Pico) package main diff --git a/examples/tmp102/main.go b/examples/tmp102/main.go index 5d764b42a..bec3fbd27 100644 --- a/examples/tmp102/main.go +++ b/examples/tmp102/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/tone/tone.go b/examples/tone/tone.go index 1e519bb80..3eeacb931 100644 --- a/examples/tone/tone.go +++ b/examples/tone/tone.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/touch/capacitive/main.go b/examples/touch/capacitive/main.go index fc3f92682..e0d55c864 100644 --- a/examples/touch/capacitive/main.go +++ b/examples/touch/capacitive/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // Capacitive touch sensing example. // // This capacitive touch sensor works by charging a normal GPIO pin, then slowly diff --git a/examples/touch/resistive/fourwire/main.go b/examples/touch/resistive/fourwire/main.go index 894e2b2fa..297630859 100644 --- a/examples/touch/resistive/fourwire/main.go +++ b/examples/touch/resistive/fourwire/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // demo of 4-wire touchscreen as described in app note: // http://ww1.microchip.com/downloads/en/Appnotes/doc8091.pdf package main diff --git a/examples/touch/resistive/pyportal_touchpaint/main.go b/examples/touch/resistive/pyportal_touchpaint/main.go index 517d3c995..8d13c1cd1 100644 --- a/examples/touch/resistive/pyportal_touchpaint/main.go +++ b/examples/touch/resistive/pyportal_touchpaint/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/ttp229/main.go b/examples/ttp229/main.go index 066699e98..087a75c95 100644 --- a/examples/ttp229/main.go +++ b/examples/ttp229/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/uc8151/main.go b/examples/uc8151/main.go index 1ee778b6b..b44f6b28a 100644 --- a/examples/uc8151/main.go +++ b/examples/uc8151/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/veml6070/main.go b/examples/veml6070/main.go index 27fbf0deb..acdfe13e6 100644 --- a/examples/veml6070/main.go +++ b/examples/veml6070/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/vl53l1x/main.go b/examples/vl53l1x/main.go index 6c18068a2..6e00c0e6b 100644 --- a/examples/vl53l1x/main.go +++ b/examples/vl53l1x/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/vl6180x/main.go b/examples/vl6180x/main.go index 21eb61f5a..7ba7942bb 100644 --- a/examples/vl6180x/main.go +++ b/examples/vl6180x/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/waveshare-epd/epd1in54/main.go b/examples/waveshare-epd/epd1in54/main.go index 11b34cfc7..a48d41061 100644 --- a/examples/waveshare-epd/epd1in54/main.go +++ b/examples/waveshare-epd/epd1in54/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/waveshare-epd/epd2in13/main.go b/examples/waveshare-epd/epd2in13/main.go index 6390afcfb..69c8313a5 100644 --- a/examples/waveshare-epd/epd2in13/main.go +++ b/examples/waveshare-epd/epd2in13/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/waveshare-epd/epd2in13x/main.go b/examples/waveshare-epd/epd2in13x/main.go index cf5086dd5..09cbe05f5 100644 --- a/examples/waveshare-epd/epd2in13x/main.go +++ b/examples/waveshare-epd/epd2in13x/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/waveshare-epd/epd2in66b/main.go b/examples/waveshare-epd/epd2in66b/main.go index a9c75b637..cccbddc87 100644 --- a/examples/waveshare-epd/epd2in66b/main.go +++ b/examples/waveshare-epd/epd2in66b/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/waveshare-epd/epd2in9/main.go b/examples/waveshare-epd/epd2in9/main.go index bc99323ce..0d0491fde 100644 --- a/examples/waveshare-epd/epd2in9/main.go +++ b/examples/waveshare-epd/epd2in9/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/waveshare-epd/epd4in2/main.go b/examples/waveshare-epd/epd4in2/main.go index a78b47431..455c57b64 100644 --- a/examples/waveshare-epd/epd4in2/main.go +++ b/examples/waveshare-epd/epd4in2/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/examples/ws2812/main.go b/examples/ws2812/main.go index 8ade21fd3..811b16c0d 100644 --- a/examples/ws2812/main.go +++ b/examples/ws2812/main.go @@ -1,3 +1,5 @@ +//go:build !lint + // Connects to an WS2812 RGB LED strip with 10 LEDS. // // See either the others.go or digispark.go files in this directory diff --git a/examples/ws2812/others.go b/examples/ws2812/others.go index 27e116e6a..045815156 100644 --- a/examples/ws2812/others.go +++ b/examples/ws2812/others.go @@ -1,4 +1,4 @@ -//go:build !digispark && !arduino +//go:build !digispark && !arduino && !lint package main diff --git a/examples/xpt2046/main.go b/examples/xpt2046/main.go index b79045825..5801d764a 100644 --- a/examples/xpt2046/main.go +++ b/examples/xpt2046/main.go @@ -1,3 +1,5 @@ +//go:build !lint + package main import ( diff --git a/flash/devices.go b/flash/devices.go index 7140e92ac..50edf92e1 100644 --- a/flash/devices.go +++ b/flash/devices.go @@ -1,3 +1,5 @@ +//go:build !lint + package flash import "time" diff --git a/flash/flash.go b/flash/flash.go index 8bf2750cb..3f1850141 100644 --- a/flash/flash.go +++ b/flash/flash.go @@ -1,3 +1,5 @@ +//go:build !lint + package flash import ( diff --git a/flash/transport_spi.go b/flash/transport_spi.go index 81db7b3f0..e8d4285da 100644 --- a/flash/transport_spi.go +++ b/flash/transport_spi.go @@ -1,3 +1,5 @@ +//go:build !lint + package flash import ( diff --git a/ft6336/ft6336.go b/ft6336/ft6336.go index 6b2032d43..7f21c7948 100644 --- a/ft6336/ft6336.go +++ b/ft6336/ft6336.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package ft6336 provides a driver for the FT6336 I2C Self-Capacitive touch // panel controller. // diff --git a/gc9a01/gc9a01.go b/gc9a01/gc9a01.go index 1426241b2..e4a4b7609 100644 --- a/gc9a01/gc9a01.go +++ b/gc9a01/gc9a01.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package gc9a01 implements a driver for the gc9a01 LCD round display // // Datasheet: https://www.waveshare.com/w/upload/5/5e/GC9A01A.pdf diff --git a/gc9a01/registers.go b/gc9a01/registers.go index 6b0e32e31..5066603d0 100644 --- a/gc9a01/registers.go +++ b/gc9a01/registers.go @@ -1,3 +1,5 @@ +//go:build !lint + package gc9a01 // Registers diff --git a/hcsr04/hcsr04.go b/hcsr04/hcsr04.go index 703fa7850..4dbcf74be 100644 --- a/hcsr04/hcsr04.go +++ b/hcsr04/hcsr04.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package hcsr04 provides a driver for the HC-SR04 ultrasonic distance sensor // // Datasheet: diff --git a/hd44780/gpio.go b/hd44780/gpio.go index 71376fcf0..b01ce68e7 100644 --- a/hd44780/gpio.go +++ b/hd44780/gpio.go @@ -1,3 +1,5 @@ +//go:build !lint + package hd44780 import ( diff --git a/hd44780/hd44780.go b/hd44780/hd44780.go index 111f70d43..827f5dbe3 100644 --- a/hd44780/hd44780.go +++ b/hd44780/hd44780.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package hd44780 provides a driver for the HD44780 LCD controller. // // Datasheet: https://www.sparkfun.com/datasheets/LCD/HD44780.pdf diff --git a/hts221/hts221_generic.go b/hts221/hts221_generic.go index a5d58f9ec..e1693d403 100644 --- a/hts221/hts221_generic.go +++ b/hts221/hts221_generic.go @@ -2,8 +2,6 @@ package hts221 -import "tinygo.org/x/drivers" - // Configure sets up the HTS221 device for communication. func (d *Device) Configure() { // read calibration data diff --git a/hub75/hub75.go b/hub75/hub75.go index 427d8490b..b1b2f800e 100644 --- a/hub75/hub75.go +++ b/hub75/hub75.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package hub75 implements a driver for the HUB75 LED matrix. // // Guide: https://cdn-learn.adafruit.com/downloads/pdf/32x16-32x32-rgb-led-matrix.pdf diff --git a/i2csoft/i2csoft.go b/i2csoft/i2csoft.go index d219bc205..116d6fa27 100644 --- a/i2csoft/i2csoft.go +++ b/i2csoft/i2csoft.go @@ -1,3 +1,5 @@ +//go:build !lint + package i2csoft import ( diff --git a/ili9341/ili9341.go b/ili9341/ili9341.go index 5ddb46395..21955d613 100644 --- a/ili9341/ili9341.go +++ b/ili9341/ili9341.go @@ -1,3 +1,5 @@ +//go:build !lint + package ili9341 import ( diff --git a/ili9341/spi.go b/ili9341/spi.go index 17ee66ac6..2ea0f5789 100644 --- a/ili9341/spi.go +++ b/ili9341/spi.go @@ -1,4 +1,4 @@ -//go:build !atsamd51 && !atsame5x && !atsamd21 +//go:build !atsamd51 && !atsame5x && !atsamd21 && !lint package ili9341 diff --git a/image/internal/compress/flate/deflate_test.go b/image/internal/compress/flate/deflate_test.go index ff5671212..61f783afd 100644 --- a/image/internal/compress/flate/deflate_test.go +++ b/image/internal/compress/flate/deflate_test.go @@ -1,3 +1,5 @@ +//go:build !lint + // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/image/internal/compress/zlib/writer_test.go b/image/internal/compress/zlib/writer_test.go index f0b38880a..2e4472c7a 100644 --- a/image/internal/compress/zlib/writer_test.go +++ b/image/internal/compress/zlib/writer_test.go @@ -1,3 +1,5 @@ +//go:build !lint + // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/irremote/receiver.go b/irremote/receiver.go index 2ba44d449..9b83d63e5 100644 --- a/irremote/receiver.go +++ b/irremote/receiver.go @@ -1,3 +1,5 @@ +//go:build !lint + package irremote // import "tinygo.org/x/drivers/irremote" import ( diff --git a/keypad4x4/keypad4x4.go b/keypad4x4/keypad4x4.go index f4adafb45..d87e7875e 100644 --- a/keypad4x4/keypad4x4.go +++ b/keypad4x4/keypad4x4.go @@ -1,3 +1,5 @@ +//go:build !lint + package keypad4x4 import ( diff --git a/l293x/l293x.go b/l293x/l293x.go index a8403b5c8..1dac19f86 100644 --- a/l293x/l293x.go +++ b/l293x/l293x.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package l293x provides a driver to the L293/L293D H-bridge chip // typically used to control DC motors. // diff --git a/l9110x/l9110x.go b/l9110x/l9110x.go index 969e1e462..eaa24cd0e 100644 --- a/l9110x/l9110x.go +++ b/l9110x/l9110x.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package l9110x provides a driver to the L9110/L9110S H-bridge chip // typically used to control DC motors. // diff --git a/mak.bak b/mak.bak new file mode 100644 index 000000000..1e4cba65d --- /dev/null +++ b/mak.bak @@ -0,0 +1,80 @@ +# find all packages without any dependency to underlying tiny-go packages, e.g. "machine" or "device/arm" +# also exclude anything found in build output directory and "image" folder +BUILD_TAGS_CHECK := m5stack_core2,microbit,xiao_ble +ALL_WITHOUT_MACHINE := $(shell go list -e -tags $(BUILD_TAGS_CHECK) -f '{{.Dir}},{{.Deps}}' ./... | awk -F, '$$1 !~ /build/ && $$1 !~ /image/ && $$2 !~ /machine/ && $$2 !~ /device\/arm/ {print $$1}') +# create a list of sub-dirs, relative to the root +ALL_DIRS_TO_CHECK := $(subst $(CURDIR),.,$(ALL_WITHOUT_MACHINE)) + +BUILD_DIR := build +LINTER_DIR := $(BUILD_DIR)/linter/drivers + +.PHONY: clean fmt-check smoke-test unit-test test check fmt_check fmt_fix $(ALL_DIRS_TO_CHECK) + +clean: + @rm -rf $(BUILD_DIR) + +FMT_PATHS = ./ + +fmt-check: + @unformatted=$$(gofmt -l $(FMT_PATHS)); [ -z "$$unformatted" ] && exit 0; echo "Unformatted:"; for fn in $$unformatted; do echo " $$fn"; done; exit 1 + +XTENSA ?= 1 +smoke-test: + @mkdir -p $(BUILD_DIR) + @go run ./smoketest.go -xtensa=$(XTENSA) smoketest.sh + + +# rwildcard is a recursive version of $(wildcard) +# https://blog.jgc.org/2011/07/gnu-make-recursive-wildcard-function.html +rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d)) +# Recursively find all *_test.go files from cwd & reduce to unique dir names +HAS_TESTS = $(sort $(dir $(call rwildcard,,*_test.go))) +# Exclude anything we explicitly don't want to test for whatever reason +EXCLUDE_TESTS = image waveshare-epd/epd2in66b +TESTS = $(filter-out $(addsuffix /%,$(EXCLUDE_TESTS)),$(HAS_TESTS)) + +unit-test: + @go test -v $(addprefix ./,$(TESTS)) + +test: clean fmt-check unit-test smoke-test + +fmt_quick_check: + @# a very fast check before build, but depends on accessibility of all imports + @# switch off the "stdmethods" analyzer is needed due to finding: + @# at24cx/at24cx.go:57:18: method WriteByte(eepromAddress uint16, value uint8) error should have signature WriteByte(byte) error + @# at24cx/at24cx.go:67:18: method ReadByte(eepromAddress uint16) (uint8, error) should have signature ReadByte() (byte, error) + @# switch off the "shift" analyzer is needed due to finding: + @#tmc5160/registers.go:1939:16: m.CUR_A (16 bits) too small for shift of 16 + @#tmc5160/registers.go:1996:16: m.X3 (8 bits) too small for shift of 27 + @#tmc5160/registers.go:1996:27: m.X2 (8 bits) too small for shift of 24 + @#tmc5160/registers.go:1996:38: m.X1 (8 bits) too small for shift of 21 + @#tmc5160/registers.go:1996:49: m.W3 (8 bits) too small for shift of 18 + @#tmc5160/registers.go:1996:60: m.W2 (8 bits) too small for shift of 16 + @#tmc5160/registers.go:1996:71: m.W1 (8 bits) too small for shift of 14 + @#tmc5160/registers.go:1996:82: m.W0 (8 bits) too small for shift of 12 + go vet -tags $(BUILD_TAGS_CHECK) -stdmethods=false -shift=false $(ALL_DIRS_TO_CHECK) + +fmt_check: + @# a complete format check, but depends on accessibility of all imports + @$(MAKE) linter_workspace + cd $(LINTER_DIR) && golangci-lint -v run + +fmt_fix: + @# an automatic reformat and complete format check, but depends on accessibility of all imports + @#TODO: activate when ready + @#gofumpt -l -w $(ALL_DIRS_TO_CHECK) # TODO: test for all files, not only for filtered ones + golangci-lint -v run $(ALL_DIRS_TO_CHECK) --fix + +linter_workspace: + @# creates the workspace for running the linter in one step, which is especially used for CI workflow, see ".github/workflows/golangci-lint.yml" + @$(MAKE) FUNC=COPY $(filter-out .,$(ALL_DIRS_TO_CHECK)) + @# additionally copy go files from root for checking + @cp -f $(CURDIR)/*.go $(LINTER_DIR) + +$(ALL_DIRS_TO_CHECK): +ifeq ($(FUNC),COPY) + @mkdir -p $(LINTER_DIR)/$@ + @cp -f $(addprefix ./,$@)/*.* $(LINTER_DIR)/$@ +else + @echo $@ +endif \ No newline at end of file diff --git a/makeybutton/button.go b/makeybutton/button.go index 69d33408f..51e56e2db 100644 --- a/makeybutton/button.go +++ b/makeybutton/button.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package makeybutton providers a driver for a button that can be triggered // by anything that is conductive by using an ultra high value resistor. // diff --git a/max6675/max6675.go b/max6675/max6675.go index eb67596b6..40e48ba2b 100644 --- a/max6675/max6675.go +++ b/max6675/max6675.go @@ -1,3 +1,5 @@ +//go:build !lint + // Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/max6675.pdf package max6675 diff --git a/max72xx/max72xx.go b/max72xx/max72xx.go index ca6c81929..70e1ad5b2 100644 --- a/max72xx/max72xx.go +++ b/max72xx/max72xx.go @@ -1,3 +1,5 @@ +//go:build !lint + // Driver works for max7219 and 7221 // Datasheet: https://datasheets.maximintegrated.com/en/ds/MAX7219-MAX7221.pdf package max72xx diff --git a/mcp2515/mcp2515.go b/mcp2515/mcp2515.go index 2b636b19b..d4dfe64e5 100644 --- a/mcp2515/mcp2515.go +++ b/mcp2515/mcp2515.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package mcp2515 implements a driver for the MCP2515 CAN Controller. // // Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/MCP2515-Stand-Alone-CAN-Controller-with-SPI-20001801J.pdf diff --git a/mcp3008/mcp3008.go b/mcp3008/mcp3008.go index 1467a70af..4dbf6fa0f 100644 --- a/mcp3008/mcp3008.go +++ b/mcp3008/mcp3008.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package mcp3008 implements a driver for the MCP3008 Analog to Digital Converter. // // Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/21295d.pdf diff --git a/microbitmatrix/microbitmatrix.go b/microbitmatrix/microbitmatrix.go index e9db240c8..247e8839c 100644 --- a/microbitmatrix/microbitmatrix.go +++ b/microbitmatrix/microbitmatrix.go @@ -1,3 +1,5 @@ +//go:build !lint + package microbitmatrix // import "tinygo.org/x/drivers/microbitmatrix" import ( diff --git a/microphone/microphone.go b/microphone/microphone.go index 60a0e3f33..471a3212e 100644 --- a/microphone/microphone.go +++ b/microphone/microphone.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package microphone implements a driver for a PDM microphone. // For example, the Adafruit PDM MEMS breakout board (https://www.adafruit.com/product/3492) // diff --git a/onewire/onewire.go b/onewire/onewire.go index ee1828387..e2b4535a8 100644 --- a/onewire/onewire.go +++ b/onewire/onewire.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package wire implements the Dallas Semiconductor Corp.'s 1-wire bus system. // // Wikipedia: https://en.wikipedia.org/wiki/1-Wire diff --git a/p1am/p1am.go b/p1am/p1am.go index a46cd71b8..71328ff0a 100644 --- a/p1am/p1am.go +++ b/p1am/p1am.go @@ -1,3 +1,5 @@ +//go:build !lint + // Driver for the P1AM-100 base controller. // // This is an embedded device on the P1AM-100 board. diff --git a/pcd8544/pcd8544.go b/pcd8544/pcd8544.go index 3a843cbab..5040b2126 100644 --- a/pcd8544/pcd8544.go +++ b/pcd8544/pcd8544.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package pcd8544 implements a driver for the PCD8544 48x84 pixels matrix LCD, used in Nokia's 5110 and 3310 phones. // // Datasheet: http://eia.udg.edu/~forest/PCD8544_1.pdf diff --git a/pcf8523/pcf8523.go b/pcf8523/pcf8523.go index 333c6e4cf..75eb0c15c 100644 --- a/pcf8523/pcf8523.go +++ b/pcf8523/pcf8523.go @@ -5,6 +5,7 @@ package pcf8523 import ( "time" + "tinygo.org/x/drivers" ) diff --git a/pcf8523/pcf8523_test.go b/pcf8523/pcf8523_test.go index ef103c4fb..f9c05033c 100644 --- a/pcf8523/pcf8523_test.go +++ b/pcf8523/pcf8523_test.go @@ -4,6 +4,7 @@ import ( "encoding/hex" "testing" "time" + "tinygo.org/x/drivers/tester" ) diff --git a/pcf8591/pcf8591.go b/pcf8591/pcf8591.go index 3bb39baaa..f51f2b2d8 100644 --- a/pcf8591/pcf8591.go +++ b/pcf8591/pcf8591.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package pcf8591 implements a driver for the PCF8591 Analog to Digital/Digital to Analog Converter. // // Datasheet: https://www.nxp.com/docs/en/data-sheet/PCF8591.pdf diff --git a/rtl8720dn/debug.go b/rtl8720dn/debug.go index f04e5b34a..689f5e7d6 100644 --- a/rtl8720dn/debug.go +++ b/rtl8720dn/debug.go @@ -1,3 +1,5 @@ +//go:build !lint + package rtl8720dn type debug uint8 diff --git a/rtl8720dn/rpc.go b/rtl8720dn/rpc.go index b554e8b0f..f330661f9 100644 --- a/rtl8720dn/rpc.go +++ b/rtl8720dn/rpc.go @@ -1,3 +1,5 @@ +//go:build !lint + // Automatically generated file. DO NOT EDIT. // Generated by github.com/sago35/go-erpcgen. diff --git a/rtl8720dn/rpc_util.go b/rtl8720dn/rpc_util.go index 68efebbe0..c90460ff8 100644 --- a/rtl8720dn/rpc_util.go +++ b/rtl8720dn/rpc_util.go @@ -1,3 +1,5 @@ +//go:build !lint + package rtl8720dn import ( diff --git a/rtl8720dn/rtl8720dn.go b/rtl8720dn/rtl8720dn.go index 6493f065a..f93669fb1 100644 --- a/rtl8720dn/rtl8720dn.go +++ b/rtl8720dn/rtl8720dn.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package rtl8720dn implements TCP wireless communication over UART // talking to a RealTek rtl8720dn module. // diff --git a/sdcard/sdcard.go b/sdcard/sdcard.go index d370bc638..db78e3ca7 100644 --- a/sdcard/sdcard.go +++ b/sdcard/sdcard.go @@ -1,3 +1,5 @@ +//go:build !lint + // package sdcard provides a TinyGo driver for sdcard/mmc devices // using a SPI connection. // diff --git a/semihosting/semihosting.go b/semihosting/semihosting.go index b08097c7f..1ea3fb527 100644 --- a/semihosting/semihosting.go +++ b/semihosting/semihosting.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package semihosting implements parts of the ARM semihosting specification, // for communicating over a debug connection. // diff --git a/semihosting/stdio.go b/semihosting/stdio.go index 247d78b41..dc066cd75 100644 --- a/semihosting/stdio.go +++ b/semihosting/stdio.go @@ -1,3 +1,5 @@ +//go:build !lint + package semihosting // These three file descriptors are connected to the host stdin/stdout/stderr, diff --git a/servo/servo.go b/servo/servo.go index e073aa130..aba1f2951 100644 --- a/servo/servo.go +++ b/servo/servo.go @@ -1,3 +1,5 @@ +//go:build !lint + package servo import ( diff --git a/sh1106/registers.go b/sh1106/registers.go index 678e5f74e..82d01a538 100644 --- a/sh1106/registers.go +++ b/sh1106/registers.go @@ -1,3 +1,5 @@ +//go:build !lint + package sh1106 // Registers diff --git a/sh1106/sh1106.go b/sh1106/sh1106.go index bff519668..852f1207a 100644 --- a/sh1106/sh1106.go +++ b/sh1106/sh1106.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package sh1106 implements a driver for the SH1106 display controller // // Copied from https://github.com/toyo/tinygo-sh1106 (under BSD 3-clause license) diff --git a/shifter/shifter.go b/shifter/shifter.go index 885222b80..844ded7e1 100644 --- a/shifter/shifter.go +++ b/shifter/shifter.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package shifter is for 8bit shift register, most common are 74HC165 and 74165 package shifter // import "tinygo.org/x/drivers/shifter" diff --git a/shiftregister/shiftregister.go b/shiftregister/shiftregister.go index 95f1f20c9..50188924d 100644 --- a/shiftregister/shiftregister.go +++ b/shiftregister/shiftregister.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package shiftregister is for 8bit shift output register using 3 GPIO pins like SN74ALS164A, SN74AHC594, SN74AHC595, ... package shiftregister diff --git a/ssd1289/pinbus.go b/ssd1289/pinbus.go index aacdf79aa..5c62570d0 100644 --- a/ssd1289/pinbus.go +++ b/ssd1289/pinbus.go @@ -1,3 +1,5 @@ +//go:build !lint + package ssd1289 import "machine" diff --git a/ssd1289/ssd1289.go b/ssd1289/ssd1289.go index f5cc22a0e..d38d658b7 100644 --- a/ssd1289/ssd1289.go +++ b/ssd1289/ssd1289.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package ssd1289 implements a driver for the SSD1289 led matrix controller as packaged on the TFT_320QVT board // // Datasheet: http://aitendo3.sakura.ne.jp/aitendo_data/product_img/lcd/tft2/M032C1289TP/3.2-SSD1289.pdf diff --git a/ssd1306/ssd1306_spi.go b/ssd1306/ssd1306_spi.go index d96299de5..120a9b77d 100644 --- a/ssd1306/ssd1306_spi.go +++ b/ssd1306/ssd1306_spi.go @@ -1,3 +1,5 @@ +//go:build !lint + package ssd1306 import ( diff --git a/ssd1331/ssd1331.go b/ssd1331/ssd1331.go index 0717c48e1..024b4abf8 100644 --- a/ssd1331/ssd1331.go +++ b/ssd1331/ssd1331.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package ssd1331 implements a driver for the SSD1331 TFT color displays. // // Datasheet: https://www.crystalfontz.com/controllers/SolomonSystech/SSD1331/381/ diff --git a/ssd1351/ssd1351.go b/ssd1351/ssd1351.go index 3561dd6ca..1233e1dc0 100644 --- a/ssd1351/ssd1351.go +++ b/ssd1351/ssd1351.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package ssd1351 implements a driver for the SSD1351 OLED color displays. // // Datasheet: https://download.mikroe.com/documents/datasheets/ssd1351-revision-1.3.pdf diff --git a/st7735/registers.go b/st7735/registers.go index 5b54780f5..f79da3184 100644 --- a/st7735/registers.go +++ b/st7735/registers.go @@ -1,3 +1,5 @@ +//go:build !lint + package st7735 import "tinygo.org/x/drivers" diff --git a/st7735/st7735.go b/st7735/st7735.go index 6f15781c2..1c64ba3fd 100644 --- a/st7735/st7735.go +++ b/st7735/st7735.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package st7735 implements a driver for the ST7735 TFT displays, it comes in various screen sizes. // // Datasheet: https://www.crystalfontz.com/controllers/Sitronix/ST7735R/319/ diff --git a/st7789/registers.go b/st7789/registers.go index 9e7818eae..064836601 100644 --- a/st7789/registers.go +++ b/st7789/registers.go @@ -1,3 +1,5 @@ +//go:build !lint + package st7789 import "tinygo.org/x/drivers" diff --git a/st7789/st7789.go b/st7789/st7789.go index 5db2402ba..273878573 100644 --- a/st7789/st7789.go +++ b/st7789/st7789.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package st7789 implements a driver for the ST7789 TFT displays, it comes in various screen sizes. // // Datasheets: https://cdn-shop.adafruit.com/product-files/3787/3787_tft_QT154H2201__________20190228182902.pdf diff --git a/sx126x/radiocontrol_pins.go b/sx126x/radiocontrol_pins.go index f2f47991f..24dbac91d 100644 --- a/sx126x/radiocontrol_pins.go +++ b/sx126x/radiocontrol_pins.go @@ -1,4 +1,4 @@ -//go:build !stm32wlx +//go:build !stm32wlx && !lint package sx126x diff --git a/sx126x/sx126x.go b/sx126x/sx126x.go index 0cee91b1d..61de55216 100644 --- a/sx126x/sx126x.go +++ b/sx126x/sx126x.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package sx126x provides a driver for SX126x LoRa transceivers. // Inspired from https://github.com/Lora-net/sx126x_driver/ diff --git a/sx127x/radiocontrol_pins.go b/sx127x/radiocontrol_pins.go index 231aea830..d9fcf82cf 100644 --- a/sx127x/radiocontrol_pins.go +++ b/sx127x/radiocontrol_pins.go @@ -1,3 +1,5 @@ +//go:build !lint + package sx127x import ( diff --git a/sx127x/sx127x.go b/sx127x/sx127x.go index f2c2a8737..f1caa11cd 100644 --- a/sx127x/sx127x.go +++ b/sx127x/sx127x.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package sx127x provides a driver for SX127x LoRa transceivers. // References: // https://electronics.stackexchange.com/questions/394296/can-t-get-simple-lora-receiver-to-work diff --git a/thermistor/thermistor.go b/thermistor/thermistor.go index 5b56c0c74..5bcabd8aa 100644 --- a/thermistor/thermistor.go +++ b/thermistor/thermistor.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package thermistor is for temperature sensing using a thermistor // such as the NTC 3950. // diff --git a/tm1637/tm1637.go b/tm1637/tm1637.go index 581a5b676..0cc8c6320 100644 --- a/tm1637/tm1637.go +++ b/tm1637/tm1637.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package tm1637 provides a driver for the TM1637 4-digit 7-segment LED display. // // Datasheet: https://www.mcielectronics.cl/website_MCI/static/documents/Datasheet_TM1637.pdf diff --git a/tmc2209/address.go b/tmc2209/address.go index d637f45f4..78c96d467 100644 --- a/tmc2209/address.go +++ b/tmc2209/address.go @@ -92,7 +92,7 @@ func ReadRegister(comm RegisterComm, driverIndex uint8, register uint8) (uint32, // Read the register value using the comm interface value, err := comm.ReadRegister(register, driverIndex) - log.Printf("Request read ", register, driverIndex, value) + log.Print("Request read ", register, driverIndex, value) if err != nil { return 0, err } diff --git a/tone/tone.go b/tone/tone.go index 9cf5f0ed1..4d5bd99fb 100644 --- a/tone/tone.go +++ b/tone/tone.go @@ -1,3 +1,5 @@ +//go:build !lint + package tone import ( diff --git a/touch/capacitive/gpio.go b/touch/capacitive/gpio.go index c98d353c7..611bcc676 100644 --- a/touch/capacitive/gpio.go +++ b/touch/capacitive/gpio.go @@ -1,3 +1,5 @@ +//go:build !lint + package capacitive import ( diff --git a/touch/resistive/fourwire.go b/touch/resistive/fourwire.go index 19037920c..eefb78d1e 100644 --- a/touch/resistive/fourwire.go +++ b/touch/resistive/fourwire.go @@ -1,3 +1,5 @@ +//go:build !lint + package resistive import ( diff --git a/ttp229/ttp229.go b/ttp229/ttp229.go index 246d249ed..0485c2fbd 100644 --- a/ttp229/ttp229.go +++ b/ttp229/ttp229.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package ttp229 is for the 16 keys or 8 keys touch pad detector IC // Datasheet (BSF version): https://www.sunrom.com/download/SUNROM-TTP229-BSF_V1.1_EN.pdf package ttp229 // import "tinygo.org/x/drivers/ttp229" diff --git a/uc8151/registers.go b/uc8151/registers.go index 407d7a44f..bbad7f206 100644 --- a/uc8151/registers.go +++ b/uc8151/registers.go @@ -1,3 +1,5 @@ +//go:build !lint + package uc8151 import "tinygo.org/x/drivers" diff --git a/uc8151/uc8151.go b/uc8151/uc8151.go index 38c48f9a0..d7d0fa29f 100644 --- a/uc8151/uc8151.go +++ b/uc8151/uc8151.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package uc8151 implements a driver for e-ink displays controlled by UC8151 // // Inspired by https://github.com/pimoroni/pimoroni-pico/blob/main/drivers/uc8151/uc8151.cpp diff --git a/waveshare-epd/epd1in54/epd1in54.go b/waveshare-epd/epd1in54/epd1in54.go index 120b356ef..49eb9d756 100644 --- a/waveshare-epd/epd1in54/epd1in54.go +++ b/waveshare-epd/epd1in54/epd1in54.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package epd1in54 implements a driver for Waveshare 1.54in black and white e-paper device. // // Derived from: diff --git a/waveshare-epd/epd1in54/registers.go b/waveshare-epd/epd1in54/registers.go index ba09c8d3f..fd966c861 100644 --- a/waveshare-epd/epd1in54/registers.go +++ b/waveshare-epd/epd1in54/registers.go @@ -1,3 +1,5 @@ +//go:build !lint + package epd1in54 // Derived from https://github.com/waveshare/e-Paper/blob/master/Arduino/epd4in2/epd4in2.h diff --git a/waveshare-epd/epd2in13/epd2in13.go b/waveshare-epd/epd2in13/epd2in13.go index e49fd4274..4a8a266fb 100644 --- a/waveshare-epd/epd2in13/epd2in13.go +++ b/waveshare-epd/epd2in13/epd2in13.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package epd2in13 implements a driver for Waveshare 2.13in black and white e-paper device. // // Datasheet: https://www.waveshare.com/w/upload/e/e6/2.13inch_e-Paper_Datasheet.pdf diff --git a/waveshare-epd/epd2in13x/epd2in13x.go b/waveshare-epd/epd2in13x/epd2in13x.go index b84f5a512..630ee28eb 100644 --- a/waveshare-epd/epd2in13x/epd2in13x.go +++ b/waveshare-epd/epd2in13x/epd2in13x.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package epd2in13x implements a driver for Waveshare 2.13in (B & C versions) tri-color e-paper device. // // Datasheet: https://www.waveshare.com/w/upload/d/d3/2.13inch-e-paper-b-Specification.pdf diff --git a/waveshare-epd/epd2in13x/registers.go b/waveshare-epd/epd2in13x/registers.go index 8577ae2fb..02163a0a5 100644 --- a/waveshare-epd/epd2in13x/registers.go +++ b/waveshare-epd/epd2in13x/registers.go @@ -1,3 +1,5 @@ +//go:build !lint + package epd2in13x // Registers diff --git a/waveshare-epd/epd2in66b/dev.go b/waveshare-epd/epd2in66b/dev.go index cadff9c04..0e2901b95 100644 --- a/waveshare-epd/epd2in66b/dev.go +++ b/waveshare-epd/epd2in66b/dev.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package epd2in66b implements a driver for the Waveshare 2.66inch E-Paper E-Ink Display Module (B) // for Raspberry Pi Pico, 296×152, Red / Black / White // Datasheet: https://files.waveshare.com/upload/e/ec/2.66inch-e-paper-b-specification.pdf diff --git a/waveshare-epd/epd2in66b/dev_test.go b/waveshare-epd/epd2in66b/dev_test.go index e970d9abe..f9f9635f8 100644 --- a/waveshare-epd/epd2in66b/dev_test.go +++ b/waveshare-epd/epd2in66b/dev_test.go @@ -1,3 +1,5 @@ +//go:build !lint + package epd2in66b import ( diff --git a/waveshare-epd/epd2in9/epd2in9.go b/waveshare-epd/epd2in9/epd2in9.go index 994cd7971..1be064ecf 100644 --- a/waveshare-epd/epd2in9/epd2in9.go +++ b/waveshare-epd/epd2in9/epd2in9.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package epd2in9 implements a driver for Waveshare 2.9in black and white e-paper device. // // Note: this is for the V1 device (using IL3820), the V2 device uses a different chipset. diff --git a/waveshare-epd/epd2in9/registers.go b/waveshare-epd/epd2in9/registers.go index 517a92b58..fe9b73213 100644 --- a/waveshare-epd/epd2in9/registers.go +++ b/waveshare-epd/epd2in9/registers.go @@ -1,3 +1,5 @@ +//go:build !lint + package epd2in9 // Registers diff --git a/waveshare-epd/epd4in2/epd4in2.go b/waveshare-epd/epd4in2/epd4in2.go index 902d21e2b..413c7a4da 100644 --- a/waveshare-epd/epd4in2/epd4in2.go +++ b/waveshare-epd/epd4in2/epd4in2.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package epd4in2 implements a driver for Waveshare 4.2in black and white e-paper device. // // Derived from: diff --git a/waveshare-epd/epd4in2/registers.go b/waveshare-epd/epd4in2/registers.go index 484b5c2be..8da183eed 100644 --- a/waveshare-epd/epd4in2/registers.go +++ b/waveshare-epd/epd4in2/registers.go @@ -1,3 +1,5 @@ +//go:build !lint + package epd4in2 // Derived from https://github.com/waveshare/e-Paper/blob/master/Arduino/epd4in2/epd4in2.h diff --git a/wifinina/debug.go b/wifinina/debug.go index 0def23f57..fed0d34fc 100644 --- a/wifinina/debug.go +++ b/wifinina/debug.go @@ -1,3 +1,5 @@ +//go:build !lint + package wifinina type debug uint8 diff --git a/wifinina/pins.go b/wifinina/pins.go index 5d7ca2b4f..5d55f9055 100644 --- a/wifinina/pins.go +++ b/wifinina/pins.go @@ -1,3 +1,5 @@ +//go:build !lint + package wifinina import "errors" diff --git a/wifinina/wifinina.go b/wifinina/wifinina.go index a70c825c2..735067d4f 100644 --- a/wifinina/wifinina.go +++ b/wifinina/wifinina.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package wifinina implements TCP wireless communication over SPI with an // attached separate ESP32 SoC using the Arduino WiFiNINA protocol. // diff --git a/ws2812/ws2812.go b/ws2812/ws2812.go index dee3cfbc8..e3298de21 100644 --- a/ws2812/ws2812.go +++ b/ws2812/ws2812.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package ws2812 implements a driver for WS2812 and SK6812 RGB LED strips. package ws2812 // import "tinygo.org/x/drivers/ws2812" diff --git a/ws2812/ws2812_generic.go b/ws2812/ws2812_generic.go index 6ab02c942..5f3181aea 100644 --- a/ws2812/ws2812_generic.go +++ b/ws2812/ws2812_generic.go @@ -1,4 +1,4 @@ -//go:build !baremetal +//go:build !baremetal && !lint package ws2812 diff --git a/xpt2046/xpt2046.go b/xpt2046/xpt2046.go index d1ef26902..80e2ace12 100644 --- a/xpt2046/xpt2046.go +++ b/xpt2046/xpt2046.go @@ -1,3 +1,5 @@ +//go:build !lint + // Package xpt2046 implements a driver for the XPT2046 resistive touch controller as packaged on the TFT_320QVT board // // Datasheet: http://grobotronics.com/images/datasheets/xpt2046-datasheet.pdf