Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] add support for VEML7700 (closes #726) #1090

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
dc229f6
Merge pull request #972 from hybridgroup/dev
gen2thomas Jul 7, 2023
ba8136f
Merge pull request #976 from hybridgroup/dev
gen2thomas Jul 7, 2023
bc0332f
Merge pull request #1023 from hybridgroup/dev
gen2thomas Oct 30, 2023
ed0c79a
Merge pull request #1054 from hybridgroup/dev
gen2thomas Jan 7, 2024
dffc48a
Create veml7700_driver.go
szampardi Oct 17, 2024
87fcb54
Create veml7700_driver_test.go
szampardi Oct 17, 2024
5be419b
ble: introduce in drivers folder (#1057)
gen2thomas Feb 4, 2024
deb7770
ble: add support for functional options, add tests (#1059)
gen2thomas Feb 10, 2024
8f9695f
examples: fix missing checks of return values (#1060)
gen2thomas Feb 11, 2024
b628db6
ble(client): add scan timout (#1051)
gen2thomas Feb 11, 2024
58f32a1
neurosky: use serialport adaptor and move driver to drivers/serial (#…
gen2thomas Feb 12, 2024
b188c1a
megapi: use serialport adaptor and move driver to drivers/serial (#1062)
gen2thomas Feb 12, 2024
fb34761
bebop: fix concurrent map writes (#1063)
gen2thomas Feb 12, 2024
8f1afdb
test: try to stabilize eventer tests (#1066)
gen2thomas Feb 13, 2024
e466884
build(go, deps): switch to Go 1.20 and update modules (#1067)
gen2thomas Feb 13, 2024
9962df6
build(linter): update linter to v1.56.1 and fix issues (#1068)
gen2thomas Feb 13, 2024
d8060e2
doc: update links to release or tagged branch (#1069)
gen2thomas Feb 13, 2024
41c18f3
gobot: rename Master to Manager (#1070)
gen2thomas Feb 13, 2024
7dc4c78
i2c/spi: remove offensive terminology (#1071)
gen2thomas Feb 13, 2024
0d0db6c
build(go, deps): update modules (#1092)
gen2thomas Oct 31, 2024
368f027
build(go, deps): switch to Go 1.22 and update modules (#1093)
gen2thomas Nov 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
23 changes: 20 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ version: 2
jobs:
"test_core_and_drivers_with_coverage":
docker:
- image: cimg/go:1.19
- image: cimg/go:1.22
steps:
- checkout
- run:
Expand All @@ -31,7 +31,7 @@ jobs:

"test_platforms":
docker:
- image: cimg/go:1.19
- image: cimg/go:1.22
steps:
- checkout
- run:
Expand All @@ -45,7 +45,7 @@ jobs:

"check_examples":
docker:
- image: cimg/go:1.19
- image: cimg/go:1.22
steps:
- checkout
- run:
Expand All @@ -59,10 +59,27 @@ jobs:
SOME=$(grep -L 'digispark' $(grep -L 'gocv' ${ALL}))
for e in ${SOME} ; do go vet "${e}" ; done

"fmt_check_examples":
docker:
- image: golangci/golangci-lint:v1.61.0
steps:
- checkout
- run:
name: Debug linter version
command: golangci-lint --version
- run:
# digispark needs libusb, opencv needs opencv
name: Check examples for linter issues (except digispark, opencv)
command: |
ALL=$(grep -l -r --include "*.go" 'build example' ./)
SOME=$(grep -L 'digispark' $(grep -L 'gocv' ${ALL}))
for e in ${SOME} ; do golangci-lint run "${e}" --build-tags example --disable forcetypeassert --disable noctx ; done

workflows:
version: 2
build:
jobs:
- "test_core_and_drivers_with_coverage"
- "test_platforms"
- "check_examples"
- "fmt_check_examples"
8 changes: 8 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ If this is a new driver or adaptor:
- [ ] I have added an example to see how to setup and use it
- [ ] I have checked or build at least my new example (e.g. by run `make examples_check`)

If this is a Go version update:

- [ ] go.mod to new version updated
- [ ] modules updated (go get -u -t ./...)
- [ ] CI files updated
- [ ] linter setting and linter version (if a newer one exist) updated
- [ ] linter issues fixed or suppressed by config

If this is a PR for release:

- [ ] The PR's target branch is 'hybridgroup:release'
Expand Down
22 changes: 8 additions & 14 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,28 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.19'
go-version: '1.22'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.55.2
version: v1.61.0

# Optional: working directory, useful for monorepos
# working-directory: v2

# Optional: golangci-lint command line arguments.
# mostly there is no problem locally, but on server: "could not import C (cgo preprocessing failed) (typecheck)"
# and the digispark adaptor can not be build since switch to linter version 1.54.2
args: --skip-files="platforms/digispark/littleWire.go,platforms/digispark/digispark_adaptor.go"
# Note: exclude arguments, e.g. --exclude-files="my_file", will not affect the "typecheck" linter,
# at least since v1.61.0 - use build tags instead.
#args: --exclude-files="platforms/digispark/digispark_adaptor.go"

# 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

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
47 changes: 25 additions & 22 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,49 +22,43 @@ run:
# By default, it isn't set.
modules-download-mode: readonly

issues:
# Enables skipping of directories:
# - vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
# Default: true
skip-dirs-use-default: false
exclude-dirs-use-default: false

# note: examples will be currently omitted by the build tag
skip-dirs:
- platforms/opencv
# note: folders/files can not be excluded from "typecheck" anymore since v1.61.0

linters:
# currently active linters:
#
# INFO [lintersdb] Active 64 linters: [asasalint asciicheck bidichk bodyclose containedctx contextcheck decorder depguard dogsled dupword durationcheck
# errcheck errchkjson errorlint exportloopref forcetypeassert gci gocheckcompilerdirectives gochecknoinits gochecksumtype gocritic gofmt gofumpt goimports
# gomoddirectives gomodguard goprintffuncname gosec gosimple govet grouper inamedparam ineffassign lll makezero mirror misspell musttag nakedret nilerr nilnil
# noctx nolintlint nonamedreturns nosprintfhostport perfsprint prealloc predeclared protogetter reassign revive sloglint staticcheck tagalign tenv
# testableexamples testifylint thelper tparallel unconvert unparam unused usestdlibvars wastedassign]
# INFO [lintersdb] Active 67 linters: [asasalint asciicheck bidichk bodyclose canonicalheader containedctx
# contextcheck decorder depguard dogsled dupword durationcheck errcheck errchkjson errorlint fatcontext
# forcetypeassert gci gocheckcompilerdirectives gochecknoinits gochecksumtype gocritic gofmt gofumpt goimports
# gomoddirectives gomodguard goprintffuncname gosec gosimple govet grouper inamedparam ineffassign lll makezero
# mirror misspell mnd musttag nakedret nilerr nilnil noctx nolintlint nonamedreturns nosprintfhostport perfsprint
# prealloc predeclared protogetter reassign revive sloglint spancheck staticcheck tagalign tenv testableexamples
# testifylint thelper tparallel unconvert unparam unused usestdlibvars wastedassign]

enable-all: true

# https://golangci-lint.run/usage/linters/#enabled-by-default
# note: typecheck can not be disabled, it is used to check code compilation
disable:
# deprecated
- deadcode # deprecated
- exhaustivestruct # deprecated
- golint # deprecated
- ifshort # deprecated
- interfacer # deprecated
- maligned # deprecated
- nosnakecase # deprecated
- scopelint # deprecated
- structcheck # deprecated
- varcheck # deprecated
# deprecated:
- exportloopref # Since Go1.22 (loopvar) this linter is no longer relevant. Replaced by copyloopvar
- gomnd # The linter has been renamed. Replaced by mnd.
# not used for this go version: none
# not used for any reason
- err113 # not used (we allow error creation at return statement)
- execinquery # not needed (no sql)
- exhaustive # not used (we allow incomplete usage of enum switch, e.g. with default case)
- forbidigo # not used (we allow print statements)
- ginkgolinter # not needed (enforces standards of using ginkgo and gomega)
- gochecknoglobals # not used (we allow definition of unexposed variables at top level)
- godot # not used (seems to be counting peas)
- godox # not used (we have many TODOs, so not useful)
- goerr113 # not used (we allow error creation at return statement)
- gosmopolitan # not needed (report i18n/l10n anti-patterns)
- importas # not needed (there is no alias rule at the moment)
- ireturn # not used (we allow return interfaces)
Expand All @@ -86,9 +80,10 @@ linters:
- goconst # useful (reduce bugs)
- gocyclo # useful with some tweeks (better understandable code)
- goheader # useful, if we introduce a common header (e.g. for copyright)
- gomnd # useful with some exclusions for existing code (e.g. mavlink.go)
- interfacebloat # useful with some exclusions at usage of external packages
- intrange # introduced with go 1.22, will simplify the range syntax
- maintidx # useful with some tweeks (better understandable code), maybe use instead "gocyclo", "gocognit" , "cyclop"
- mnd # useful with some exclusions for existing code (e.g. mavlink.go)
- nestif # useful (reduce bugs, simplify code, better understandable code)
- nlreturn # more common style, but could become annoying
- stylecheck # useful with some tweaking (e.g. underscores in names should be allowed - we use it for constants retrieved from C/C++)
Expand Down Expand Up @@ -168,6 +163,14 @@ linters-settings:
# Default: false
require-specific: true

perfsprint:
# Optimizes `fmt.Errorf`.
# Default: true
errorf: false
# Optimizes `fmt.Sprintf` with only one argument
# Default: true
sprintf1: false

revive:
rules:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-return
Expand Down
22 changes: 11 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@

### core

* Add Running() methods for Master and Robot and increase test coverage accordingly
* Add Running() methods for Manager and Robot and increase test coverage accordingly

### sysfs

Expand Down Expand Up @@ -1647,17 +1647,17 @@
### core

* Refactoring to allow 'Metal' development using Gobot packages
* Able to run robots without being part of a Master.
* Able to run robots without being part of a Manager.
* Now running all work in separate goroutines
* Rename internal name of Master type
* Rename internal name of Manager type
* Refactor events to use channels all the way down.
* Eliminate potential race conditions from Events and Every functions
* Add Unsubscribe() to Eventer, now Once() works as expected
* DeleteEvent function added to Eventer interface
* Ranges over event channels instead of using select
* No longer return non-standard slices of errors, instead use hashicorp/go-multierror
* Ensure that all drivers have default names
* Now both Robot and Master operate using AutoRun as expected
* Now both Robot and Manager operate using AutoRun as expected
* Use canonical import domain of gobot.io for all code
* Use time.Sleep unless waiting for a timeout in a select
* Uses time.NewTimer() instead of time.After() to be more efficient
Expand Down Expand Up @@ -2456,7 +2456,7 @@
* Replaced ginkgo/gomega with system testing package
* Refactor gobot/robot/device commands
* Added Event type
* Replaced Master type with Gobot type
* Replaced Manager type with Gobot type
* Every` and `After` now accept `time.Duration`
* Removed reflection helper methods

Expand Down Expand Up @@ -2580,7 +2580,7 @@
* Finalize on SIGINT
* Publish function for driver events
* device test coverage
* master and robot test coverage
* manager and robot test coverage

### Clean

Expand All @@ -2600,7 +2600,7 @@

### Refactor

* robot and master
* robot and manager

### Remove

Expand Down Expand Up @@ -2636,8 +2636,8 @@
* Travis banner to README
* api commands
* POST command
* master example
* robot master
* manager example
* robot manager
* Sphero example
* Digispark to list of supported platforms
* helper functions
Expand Down Expand Up @@ -2737,11 +2737,11 @@

### Rename

* Gobot struct to Master
* Gobot struct to Manager

### Set

* GOMAXPROCS property in GobotMaster
* GOMAXPROCS property in GobotManager

### Skeleton

Expand Down
5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ Descriptions for each of these will eventually be provided below.

## General Guidelines

* All active development is in the `dev` branch. New or updated features must be added to the `dev` branch. Hotfixes
will be considered on the `master` branch in situations where it does not alter behavior or features, only fixes a bug.
* All active development is in the `dev` branch. New or updated features must be added to the `dev` branch.
* All patches must be provided under the Apache 2.0 License
* Please use the -S option in git to "sign off" that the commit is your work and you are providing it under the
Apache 2.0 License
Expand Down Expand Up @@ -142,4 +141,4 @@ Gobot is released with a Contributor Code of Conduct. By participating in this p

## Origins

This document is based on the original [io.js contribution guidelines](https://github.com/nodejs/io.js/blob/master/CONTRIBUTING.md)
This document is based on the original [io.js contribution guidelines](https://github.com/nodejs/io.js/blob/main/CONTRIBUTING.md)
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ EXAMPLES_NO_GOCV := $(shell grep -L 'gocv' $(ALL_EXAMPLES))
# used examples
EXAMPLES := $(EXAMPLES_NO_GOCV)

.PHONY: test test_race test_cover robeaux version_check fmt_check fmt_fix examples examples_check $(EXAMPLES)
.PHONY: test test_race test_cover robeaux version_check fmt_check fmt_fix examples examples_check examples_fmt_fix $(EXAMPLES)

# opencv platform currently skipped to prevent install of preconditions
including_except := $(shell go list ./... | grep -v platforms/opencv)

# Run tests on nearly all directories without test cache, with race detection
test_race:
go test -failfast -count=1 -v -race $(including_except)
go test -failfast -count=1 -race $(including_except) -tags libusb

# Run tests on nearly all directories without test cache
test:
Expand Down Expand Up @@ -65,9 +65,15 @@ examples: $(EXAMPLES)
examples_check:
$(MAKE) CHECK=ON examples

examples_fmt_fix:
$(MAKE) CHECK=FMT examples

$(EXAMPLES):
ifeq ($(CHECK),ON)
go vet ./$@
else ifeq ($(CHECK),FMT)
gofumpt -l -w ./$@
golangci-lint run ./$@ --fix --build-tags example,libusb --disable forcetypeassert --disable noctx
else
go build -o /tmp/gobot_examples/$@ ./$@
endif
Loading