Commit Graph

19 Commits

Author SHA1 Message Date
Mike Nguyen 59acca46a6
chore!: upgrade lint & go (#649)
* chore: bump go to 1.23.3 and golangci-lint to 1.61.0

Signed-off-by: mikeee <hey@mike.ee>

* fix: ineffective nolint directive removed

Signed-off-by: Mike Nguyen <hey@mike.ee>

* fix: perfsprint recommendations

Signed-off-by: Mike Nguyen <hey@mike.ee>

* fix: intrange recommendations - refactor loops

Signed-off-by: Mike Nguyen <hey@mike.ee>

* fix: remove existing dereferencing copies

Signed-off-by: Mike Nguyen <hey@mike.ee>

* fix!: address gosec overflows

BREAKING CHANGE: State consistency, concurrency and operation types are now int32 sized.
Panic on an overflow conversion for a proto duration

Signed-off-by: Mike Nguyen <hey@mike.ee>

* fix: tooling lint issues/ci update

Signed-off-by: Mike Nguyen <hey@mike.ee>

* fix: perfsprint suggestions on dapr-bot

Signed-off-by: Mike Nguyen <hey@mike.ee>

* chore(ci): remove gover remnants

Signed-off-by: Mike Nguyen <hey@mike.ee>

* chore(ci): upgrade golangci-lint action version

Signed-off-by: Mike Nguyen <hey@mike.ee>

---------

Signed-off-by: mikeee <hey@mike.ee>
Signed-off-by: Mike Nguyen <hey@mike.ee>
2024-11-13 22:01:59 -07:00
Willi Eggeling 4a9f1800b6
removed unnecessary warnings from actor reflection (#586)
When checking for valid Actor methods, the SDK no longer emits warnings about invalid or inappropriate method signatures for the ones needed to be implemented for each Actor type.

Fixes #585

Signed-off-by: Willi Eggeling <thewilli@users.noreply.github.com>
2024-07-22 12:51:47 -07:00
mikeee 04f7b595b6
feat: go1.20 and golangci-lint v1.55.2 (#480)
* fix: remove invalid 'unused' config and fix wsl trailing whitespace key name

Signed-off-by: mikeee <hey@mike.ee>

* fix: disable inamedparam linter

Signed-off-by: mikeee <hey@mike.ee>

* fix: update package and tool to go1.21.5

Signed-off-by: mikeee <hey@mike.ee>

* fix: correct majority of the testifylinter issues relating to error assertions

Signed-off-by: mikeee <hey@mike.ee>

* fix: reverse actual and expected values

Signed-off-by: mikeee <hey@mike.ee>

* fix: correct test cases

Signed-off-by: mikeee <hey@mike.ee>

* fix: correct misspell - upsert

Signed-off-by: mikeee <hey@mike.ee>

* fix: add missing import

Signed-off-by: mikeee <hey@mike.ee>

* update: bump validation workflow to 1.21

Signed-off-by: mikeee <hey@mike.ee>

* fix: refactor direct access references to proto fields

Signed-off-by: mikeee <hey@mike.ee>

* fix: revert to go1.20 retaining version-1 support

Signed-off-by: mikeee <hey@mike.ee>

* fix: update test-dapr-bot workflow golangci-lint ver to 1.55.2

Signed-off-by: mikeee <hey@mike.ee>

* fix: fix assertions for dapr-bot and check-lint-version

Signed-off-by: mikeee <hey@mike.ee>

* fix: remove length function call

Signed-off-by: mikeee <hey@mike.ee>

* fix: fix StateConsistency logic and add tests to satisfy codecov

Signed-off-by: mikeee <hey@mike.ee>

* tests: add coverage of empty store names for delete bulk state item method

Signed-off-by: mikeee <hey@mike.ee>

---------

Signed-off-by: mikeee <hey@mike.ee>
2023-12-11 10:51:26 +08:00
Mike 57466dd68e
feat: add golangci-lint (local) version check (#467)
* feat: add golangci-lint version check

Add golangci-lint version check to compare the
local version against the workflow version.

Adds associated test workflow for mac, ubuntu and windows.

Signed-off-by: mikeee <hey@mike.ee>

* fix: add install linter step

Signed-off-by: mikeee <hey@mike.ee>

* fix: return the raw output of the command run

Signed-off-by: mikeee <hey@mike.ee>

* fix: change regex to pick up versions not prefixed

Signed-off-by: mikeee <hey@mike.ee>

* formatting: gofumpt'ed workspace

Signed-off-by: mikeee <hey@mike.ee>

* fix: convert line endings to LF on checkout

Signed-off-by: mikeee <hey@mike.ee>

* fix: encapsulate any spaces in the argument

Signed-off-by: mikeee <hey@mike.ee>

---------

Signed-off-by: mikeee <hey@mike.ee>
2023-10-20 14:15:47 -07:00
Mike 6c9a8c29c8
Upgrade to golangci-lint to 1.54.2 and updates depguard config interface (#443)
* bump golangci version

Signed-off-by: mikeee <hey@mike.ee>

* refactor depguard config

Signed-off-by: mikeee <hey@mike.ee>

* exclude unused options

Signed-off-by: mikeee <hey@mike.ee>

* remove locale option

Signed-off-by: mikeee <hey@mike.ee>

* reassign iterated variables inside the loops

Signed-off-by: mikeee <hey@mike.ee>

---------

Signed-off-by: mikeee <hey@mike.ee>
2023-09-08 16:33:30 -07:00
Mike 710492a89c
fix actor serialization (#441)
* substitute json encoder with serializer

Signed-off-by: mikeee <hey@mike.ee>

* substitution for custom serializer

Signed-off-by: mikeee <hey@mike.ee>

---------

Signed-off-by: mikeee <hey@mike.ee>
2023-09-08 16:31:28 -07:00
Josh van Leeuwen df5bd08997
Add note about Actor State `WithTTL` being feature preview. (#408)
Signed-off-by: joshvanl <me@joshvanl.dev>
2023-05-29 09:59:51 +08:00
hunter007 3929306e36
Update go version to 1.19 (#403)
* update go version to 1.19

Signed-off-by: hunter007 <wentao79@gmail.com>

* add timeout for golangci-lint

Signed-off-by: hunter007 <wentao79@gmail.com>

* fix golangci-lint

Signed-off-by: hunter007 <wentao79@gmail.com>

* use revive instead of goliint in .golangci.yml

Signed-off-by: hunter007 <wentao79@gmail.com>

* if-return: redundant if ...; err != nil check, just return error instead.

Signed-off-by: hunter007 <wentao79@gmail.com>

* fix

Signed-off-by: hunter007 <wentao79@gmail.com>

* update golangci-lint from v1.50.1 to v1.52.2

Signed-off-by: hunter007 <wentao79@gmail.com>

---------

Signed-off-by: hunter007 <wentao79@gmail.com>
2023-05-20 07:36:37 -07:00
Josh van Leeuwen d58007df4d
Actor state client `SetWithTTL` (#383)
* Adds context to rest of funcs, so context can always be propagated.

Signed-off-by: joshvanl <me@joshvanl.dev>

* Use separate interface for structs with context funcs

Signed-off-by: joshvanl <me@joshvanl.dev>

* Update proto to include actor state transaction metadata

Signed-off-by: joshvanl <me@joshvanl.dev>

* Adds `SetWithTTL` to actor state store manager

Signed-off-by: joshvanl <me@joshvanl.dev>

* Update actor client to support sending metadata. Supports `ttlInSeconds`

Signed-off-by: joshvanl <me@joshvanl.dev>

* Update actor example to use SetWithTTL with note that it should always
be used

Signed-off-by: joshvanl <me@joshvanl.dev>

* Update go modules

Signed-off-by: joshvanl <me@joshvanl.dev>

* Ignore deprecated use of `actor.Server` in `ActorContainer` interface

Signed-off-by: joshvanl <me@joshvanl.dev>

---------

Signed-off-by: joshvanl <me@joshvanl.dev>
2023-04-27 15:31:36 -07:00
Josh van Leeuwen 0cc2c4ce7a
Create `xxxContext` functions for ones which are missing a caller context. (#358)
* Adds context to rest of funcs, so context can always be propagated.

Signed-off-by: joshvanl <me@joshvanl.dev>

* Adds `//nolint:interfacebloat` to StateManager interface due to new
`xxxContext` methods.

Signed-off-by: joshvanl <me@joshvanl.dev>

* Use separate interface for structs with context funcs

Signed-off-by: joshvanl <me@joshvanl.dev>

* Adds more locks to actor functions

Signed-off-by: joshvanl <me@joshvanl.dev>

---------

Signed-off-by: joshvanl <me@joshvanl.dev>
2023-03-29 07:40:51 -07:00
Alessandro (Ale) Segala c5377994aa
Various fixes and cleanups (#346)
* Various fixed and cleanups

1. Fixed SDK not compiling and tests failing
2. Increased minimum Go version to 1.18
3. Removed `github.com/pkg/errors` and `go.uber.org/atomic` - replaced with the standard library instead (the old packages have been added to the "depguard" linter)
4. Upgraded all dependencies
5. Upgraded golangci-lint to support Go 1.18+

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>

* Do not wrap error if nil

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>

* Run CI on Go 1.18 and 1.19

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>

* Restore compatibility with Go 1.18

Looks like the newer methods were added in Go 1.19 only

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>

* Should fix validate_examples CI

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>

* Updated (most) deprecated Actions

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>

* Fix helm repo

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>

* Determine latest Dapr version in a better way

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>

* Fix validate.sh

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
2023-01-09 10:38:37 -08:00
wXwcoder 014b4d6836
fix #326 Differentiating between actor state key not found vs. unexpected error (#333)
* return the specific error type of the actor state, caused by empty key or unmarshal fail

Signed-off-by: wangxw <996268132@qq.com>

* Update state_async_provider.go

change log level of state load

Signed-off-by: wXwcoder <996268132@qq.com>

Signed-off-by: wangxw <996268132@qq.com>
Signed-off-by: wXwcoder <996268132@qq.com>
2022-11-14 13:19:34 +08:00
Chris Gillum c1556a4bf1
Fix panic in actor server when invalid methods encountered (#324)
I was debugging a panic in a local application I was developing and noticed this issue. A validation failure isn't correctly handled as a failure, and we insert a nil value into the map. This value in this map is later dereferenced, resulting in the following panic:

```
http: panic serving 127.0.0.1:45598: runtime error: invalid memory address or nil pointer dereference
goroutine 248 [running]:
net/http.(*conn).serve.func1()
        /home/linuxbrew/.linuxbrew/Cellar/go/1.19.1/libexec/src/net/http/server.go:1850 +0xbf
panic({0x9558a0, 0xe4d7c0})
        /home/linuxbrew/.linuxbrew/Cellar/go/1.19.1/libexec/src/runtime/panic.go:890 +0x262
github.com/dapr/go-sdk/actor/manager.(*DefaultActorContainer).Invoke(0xc0000be810, {0xc000048126?, 0x9?}, {0xc0003fc000, 0x4, 0x200})
        /home/cgillum/go/pkg/mod/github.com/dapr/go-sdk@v1.5.0/actor/manager/container.go:75 +0x299
github.com/dapr/go-sdk/actor/manager.(*DefaultActorManager).InvokeMethod(0xc000112300, {0xc000048115?, 0xc0000a3888?}, {0xc000048126, 0x4}, {0xc0003fc000, 0x4, 0x200})
        /home/cgillum/go/pkg/mod/github.com/dapr/go-sdk@v1.5.0/actor/manager/manager.go:92 +0xb2
github.com/dapr/go-sdk/actor/runtime.(*ActorRunTime).InvokeActorMethod(0xa?, {0xc00004810c?, 0x7f71edd544a0?}, {0xc000048115, 0x9}, {0xc000048126, 0x4}, {0xc0003fc000, 0x4, 0x200})
        /home/cgillum/go/pkg/mod/github.com/dapr/go-sdk@v1.5.0/actor/runtime/actor_runtime.go:75 +0xba
github.com/dapr/go-sdk/service/http.(*Server).registerBaseHandler.func4({0xad7298, 0xc0003b0000}, 0xc0004e4100)
        /home/cgillum/go/pkg/mod/github.com/dapr/go-sdk@v1.5.0/service/http/topic.go:112 +0x1be
net/http.HandlerFunc.ServeHTTP(0xc0004e4000?, {0xad7298?, 0xc0003b0000?}, 0x800?)
        /home/linuxbrew/.linuxbrew/Cellar/go/1.19.1/libexec/src/net/http/server.go:2109 +0x2f
github.com/gorilla/mux.(*Router).ServeHTTP(0xc000218240, {0xad7298, 0xc0003b0000}, 0xc0003b4600)
        /home/cgillum/go/pkg/mod/github.com/gorilla/mux@v1.8.0/mux.go:210 +0x1cf
net/http.serverHandler.ServeHTTP({0xad62e8?}, {0xad7298, 0xc0003b0000}, 0xc0003b4600)
        /home/linuxbrew/.linuxbrew/Cellar/go/1.19.1/libexec/src/net/http/server.go:2947 +0x30c
net/http.(*conn).serve(0xc0000001e0, {0xad7a00, 0xc00012b380})
        /home/linuxbrew/.linuxbrew/Cellar/go/1.19.1/libexec/src/net/http/server.go:1991 +0x607
created by net/http.(*Server).Serve
        /home/linuxbrew/.linuxbrew/Cellar/go/1.19.1/libexec/src/net/http/server.go:3102 +0x4db
```

The issue appears to be the error handling logic, which I've fixed in this PR.

Signed-off-by: Chris Gillum <cgillum@gmail.com>

Signed-off-by: Chris Gillum <cgillum@gmail.com>
2022-09-20 18:23:44 -07:00
Laurence 6f2ae7df71
fix: config api (#200)
* Fix: Finished Configuration API

Signed-off-by: LaurenceLiZhixin <382673304@qq.com>

* Fix: add configuration validation

Signed-off-by: LaurenceLiZhixin <382673304@qq.com>

* Fix: fix validation test

Signed-off-by: LaurenceLiZhixin <382673304@qq.com>

* Fix: remove validation

Signed-off-by: LaurenceLiZhixin <382673304@qq.com>

* add ut

Signed-off-by: LaurenceLiZhixin <382673304@qq.com>

* Fix: comment

Signed-off-by: LaurenceLiZhixin <382673304@qq.com>
2022-04-05 17:43:32 -07:00
Joni Collinge 8cc42bd7e3
Fix misspelt activateActor name (#253)
* fix misspelt deactiveActor method

Signed-off-by: Joni Collinge <jonathancollinge@live.com>

* fix mocks and tests

Signed-off-by: Joni Collinge <jonathancollinge@live.com>
2022-01-31 09:06:28 -08:00
Timon Wong d3c3384c4e
Fix error saving actor state for readonly changes (#233)
Signed-off-by: Tianpeng Wang <tpwang@alauda.io>
2022-01-11 09:37:26 -08:00
Dmitry Shmulevich a38be4e38b
replace license headers (#232)
Signed-off-by: Dmitry Shmulevich <dmitry.shmulevich@gmail.com>
2021-12-14 12:06:12 -08:00
Dmitry Shmulevich b93a185fa4
add TTL to actor timer/reminder requests (#225) 2021-12-08 09:36:48 +08:00
Laurence d9ad49d2a6
Feat: Add Go-sdk Actor Support (#196)
* ftr: init go-sdk action

* fix: finished design of actor-api's invoke feature

* fix: add readme

* fix: lint

* fix: add manager unit test

* fix: add actor state suport

* fix: add comments

* fix: add comment

* fix the change reqeust of pr

* fix: validate example test

* fix: linter

* add actor validation

* add actor validation

* fix: update actor validation init sleep time

* fix: add init time for validate example server

* fix: change actor to the end of test in order not to let reminder bother other test

* fix: validate test

* fix: typo of factory

* fix: add init time

* fix: ut

Co-authored-by: Yaron Schneider <yaronsc@microsoft.com>
Co-authored-by: Long Dai <long.dai@intel.com>
2021-11-02 14:45:27 -07:00