Commit Graph

51 Commits

Author SHA1 Message Date
Abhinav Gupta
b99530f7f5 README: Fix legacy import path instructions (#60)
In migrating to Go modules, we had to decide between the import paths
github.com/uber-go/atomic and go.uber.org/atomic. We chose the latter.

As a result of this, users of the legacy import path would get an error
message similar to the following:

    github.com/uber-go/atomic: github.com/uber-go/atomic@v1.5.0: parsing go.mod:
    module declares its path as: go.uber.org/atomic
            but was required as: github.com/uber-go/atomic

We suggested that users of the legacy import path add the following to
their go.mod.

    replace github.com/uber-go/atomic => go.uber.org/atomic v1.5.0

This is inaccurate and will result in the following error message:

    go.uber.org/atomic@v1.5.0 used for two different module paths
    (github.com/uber-go/atomic and go.uber.org/atomic)

This was not detected before because `go mod tidy` works fine with this
`replace` directive. It fails only when it gets to `go build`.

After digging into this more, per section 4.4 of the resolution section
of [How can I resolve "parsing go.mod: unexpected module path" (..)][1],
the correct method of resolving this is to downgrade the legacy import
path to a version prior to the use of Go modules.

  [1]: https://github.com/golang/go/wiki/Modules#how-can-i-resolve-parsing-gomod-unexpected-module-path-and-error-loading-module-requirements-errors-caused-by-a-mismatch-between-import-paths-vs-declared-module-identity

So the correct `replace` directive here would be,

    replace github.com/uber-go/atomic => github.com/uber-go/atomic v1.4.0

This fix was verified both, locally and by @atibhav21 who first ran into
this.
2019-11-04 15:54:56 -08:00
Abhinav Gupta
fb77e1d737 Back to development 2019-10-29 15:14:36 -07:00
Abhinav Gupta
9dc4df04d0 Preparing release v1.5.0 (#58) v1.5.0 2019-10-29 15:13:04 -07:00
Abhinav Gupta
473b9563f0 Switch to Go modules (#56)
This switches atomic to Go modules. This has the effect of simplifying
the Makefile and the Travis build, as well as getting rid of the overly
complicated coverage script we copied here.

Tools dependencies (currently only golint) were added to the tools.go.

As a result of this change, we no longer support the non-vanity import path
github.com/uber-go/atomic. Users must use the vanity import path, or add a
`replace` directive.

Supersedes #40
2019-10-29 15:04:38 -07:00
Abhinav Gupta
187d219e0c Add a CHANGELOG (#57)
This adds a CHANGELOG.md to the project, retroactively filling it up
based on https://github.com/uber-go/atomic/releases.
2019-10-29 14:13:54 -07:00
Sergey Shepelev
ef0d20d85b Fix typo in make lint rule (#55) 2019-07-31 12:47:37 -07:00
Prashant Varanasi
df976f2515 Run lint on 1.12, remove pre-1.11 versions (#52)
Clean up the Makefile to use ./... instead of a packages variable.

Golint checks vendor when used with "./..." so use `go list ./...`.
This lint check was previously not even running (PKGS was undefined).
v1.4.0
2019-05-01 13:56:49 -07:00
Abhinav Gupta
5a6ca66254 README: Switch to travis-ci.com for badge (#51) 2019-04-29 13:45:39 -07:00
Prashant Varanasi
5328d69c76 Simplify lint version select, control via .travis.yml (#46)
This is similar to tchannel, see
https://github.com/uber/tchannel-go/pull/651

and
https://github.com/uber/tchannel-go/blob/dev/.travis.yml
2019-02-25 17:13:05 -08:00
William Banfield
8dc6146f75 switch hr to native markdown to render link (#43) 2018-10-18 14:50:23 -07:00
alexeypavlenko
bb9a8edc0f Introduce an atomic type-safe wrapper around error type. (#42) 2018-09-27 09:07:59 -07:00
Oleg Kovalov
ca68046243 Update Go versions on Travis (#41) 2018-08-05 21:53:14 -07:00
Nathan Jordan
1ea20fb1cb add atomic duration type (#37)
wrapper around existing `Int64` type for atomic operations on `time.Duration` values
v1.3.2
2018-05-01 10:38:09 -07:00
Prashant Varanasi
8474b86a5a Add standard library atomic operations to benchmark (#35)
Currently, we only benchmark our custom atomic types, but don't
benchmark the standard library types. Add benchmarks for ints and uints
that the standard library supports.
v1.3.1
2017-11-14 12:44:01 -08:00
Prashant Varanasi
54e9e20165 Add parallel benchmarks (#34)
Atomic operations tend to be fast when there's no contention but get a
lot slower with contention, so add tests which run the same stress test
in parallel.
2017-11-14 11:42:34 -08:00
Prashant Varanasi
0ee2c2d995 Concurrently modify same atomic in stress tests (#33)
Currently, the stress tests start multiple goroutines, but they all have
their own local atomic, so they are not concurrently modifying the same
values. Return a function which can be run concurrently to modify the
same atomic.
2017-11-14 10:36:59 -08:00
Prashant Varanasi
e81582a97d Revert "Optimization for String.Store("")" (#32)
This optimization causes data races since we're changing the value field
without using atomics. E.g., a caller who has multiple goroutines
calling `Set("1")` and `Set("")` will race on the access to `s.v` since
one goroutine is trying to read it while the other sets it, neither
using atomic operations.

This reverts commit 16b44f14f0.
2017-11-14 08:16:11 -08:00
Grayson Koonce
54f72d3243 Test Go 1.9 (#31) v1.3.0 2017-08-29 15:32:23 -07:00
Bill Fumerola
70bd1261d3 Use stress tests for benchmarks 2017-07-19 18:46:50 -04:00
Bill Fumerola
16b44f14f0 Optimization for String.Store("") 2017-07-19 18:44:22 -04:00
Prashant Varanasi
0506d69f55 Add .codecov with status checking for 100% coverage (#30) 2017-06-08 17:20:07 -07:00
Prashant Varanasi
3c3f2a99a1 Point coverage badge at codecov instead of coveralls 2017-06-08 16:17:25 -07:00
Prashant Varanasi
d245187332 Try codecov instead of coveralls (#28) 2017-06-08 16:14:49 -07:00
Bill Fumerola
908889c45e goreportcard badge 2017-05-24 19:49:27 -07:00
Bill Fumerola
a85b15eff9 Use our own Value for String 2017-05-09 14:47:25 -07:00
Prashant Varanasi
3f020e6d5d Add Bool.CAS for compare-and-swap semantics (#23) 2017-05-09 12:57:10 -07:00
Oleg Kovalov
1d7f075bbe Update Travis to run Go 1.7 and 1.8 versions (#22) 2017-04-30 10:40:09 -07:00
bill fumerola
4e336646b2 Shadow atomic.Value from sync/atomic (#19) v1.2.0 2017-04-10 19:30:53 -07:00
bill fumerola
1dcf4eb483 Update lint-worthy version list (#20) 2017-04-10 17:14:58 -07:00
Anton Tyurin
3b8db5e93c Implement Add/Sub for Float64 (#17)
Signed-off-by: Anton Tiurin <noxiouz@yandex.ru>
v1.1.0
2016-12-15 11:56:52 -08:00
Bill Fumerola
74ca5ec650 Add stress test for Float64 2016-12-14 13:12:48 -08:00
bill fumerola
14746df0c2 Merge pull request #16 from uber-go/refactor_stress
Refactor stress tests and wait for the results
2016-12-13 11:16:23 -08:00
Prashant Varanasi
9058d5b913 Refactor stress tests and wait for the results
Previously, we were not waiting for the spawned goroutines to end.
Refactor the logic to use a common runStress that runs some function
from multiple goroutines.
2016-12-13 11:10:34 -08:00
Prashant Varanasi
9e99152552 Fix Go tip errors with self-import (#14) 2016-10-27 09:36:08 -07:00
Prashant Varanasi
0ab99594f7 Use go.uber.org import path (#13) 2016-10-27 00:33:41 -07:00
Kunal Thakar
6c2817a9ef Atomic wrapper around float64 (#12) 2016-10-19 17:45:26 -07:00
Prashant Varanasi
0c9e689d64 Merge pull request #10 from uber-go/unexport
Use unexported field name instead of embedding
v1.0.0
2016-07-18 13:38:59 -07:00
Prashant Varanasi
e59e67d981 Use unexported field name instead of embedding
Unexported field name means the methods on different types look
more similar (e.g., &i.v instead of &i.int32 or &i.uint32).

For String, this is important since we don't want users to be
able to access the underlying atomic.Value
2016-07-18 12:50:08 -07:00
Prashant Varanasi
16e575a521 Merge pull request #9 from uber-go/string_bug
Fix NewString disregarding the passed in string
2016-07-18 11:25:57 -07:00
Prashant Varanasi
d938bba906 Fix NewString disregarding the passed in string 2016-07-18 11:07:34 -07:00
Prashant Varanasi
3725100ae4 Merge pull request #8 from uber-go/string
Add String as a type-safe wrapper for atomic.Value
2016-07-17 23:05:33 -07:00
Prashant Varanasi
fecc23564a Add String as a type-safe wrapper for atomic.Value 2016-07-17 12:43:23 -07:00
Prashant Varanasi
e682c1008a Fix glide.yaml and run glide up 2016-05-31 17:23:56 -07:00
Prashant Varanasi
b4ee65f3b3 Use glide nv instead of novendor 2016-05-31 17:14:21 -07:00
Akshay Shah
7afff28c37 Add an atomic Boolean type (#4)
* Add an atomic Boolean type

Fixes #2.

* Feedback from CR

- Rename Swap to Toggle
- Add a more Swap-like Swap

* Add boolToInt helper
2016-05-30 11:10:24 -07:00
Akshay Shah
e1b75a466a Lint on Travis (#7) 2016-05-29 20:54:38 -07:00
Akshay Shah
68f9c8c0d0 Add docs and linters before release (#6)
* Add a lint target to Makefile

* Add a README

* Add a simple example

* Add a PR template

* Show off usable zero values
2016-05-29 20:50:32 -07:00
Akshay Shah
2051a605b9 Add a Sub method to atomics (#5)
* Add a Sub method to atomics

Fixes #3.

* Invert integer sign without multiplying
2016-05-28 22:54:33 -07:00
Prashant Varanasi
be53a1df0f Merge pull request #1 from uber-go/import
Import atomic package
2016-05-25 11:05:37 -07:00
Prashant Varanasi
928a9d776b Import atomic package
The code is the same as github.com/uber/tchannel-go/atomic
2016-05-25 11:04:20 -07:00