• Stars
    star
    1,250
  • Rank 36,055 (Top 0.8 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 8 years ago
  • Updated 24 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Wrapper types for sync/atomic which enforce atomic access

atomic GoDoc Build Status Coverage Status Go Report Card

Simple wrappers for primitive types to enforce atomic access.

Installation

$ go get -u go.uber.org/atomic@v1

Legacy Import Path

As of v1.5.0, the import path go.uber.org/atomic is the only supported way of using this package. If you are using Go modules, this package will fail to compile with the legacy import path path github.com/uber-go/atomic.

We recommend migrating your code to the new import path but if you're unable to do so, or if your dependencies are still using the old import path, you will have to add a replace directive to your go.mod file downgrading the legacy import path to an older version.

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

You can do so automatically by running the following command.

$ go mod edit -replace github.com/uber-go/atomic=github.com/uber-go/[email protected]

Usage

The standard library's sync/atomic is powerful, but it's easy to forget which variables must be accessed atomically. go.uber.org/atomic preserves all the functionality of the standard library, but wraps the primitive types to provide a safer, more convenient API.

var atom atomic.Uint32
atom.Store(42)
atom.Sub(2)
atom.CompareAndSwap(40, 11)

See the documentation for a complete API specification.

Development Status

Stable.


Released under the MIT License.

More Repositories

1

zap

Blazing fast, structured, leveled logging in Go.
Go
20,876
star
2

guide

The Uber Go Style Guide.
Makefile
15,131
star
3

fx

A dependency injection based application framework for Go.
Go
5,186
star
4

goleak

Goroutine leak detector
Go
4,263
star
5

ratelimit

A Go blocking leaky-bucket rate limit implementation
Go
3,934
star
6

dig

A reflection based dependency injection toolkit for Go.
Go
3,596
star
7

automaxprocs

Automatically set GOMAXPROCS to match Linux container CPU quota.
Go
3,459
star
8

mock

GoMock is a mocking framework for the Go programming language.
Go
1,582
star
9

multierr

Combine one or more Go errors together
Go
907
star
10

tally

A Go metrics interface with fast buffered metrics and third party reporters
Go
810
star
11

gopatch

Refactoring and code transformation tool for Go.
Go
681
star
12

nilaway

Static Analysis tool to detect potential Nil panics in Go code
Go
400
star
13

config

Configuration for Go applications
Go
382
star
14

cadence-client

Framework for authoring workflows and activities running on top of the Cadence orchestration engine.
Go
322
star
15

sally

A tiny HTTP server for supporting custom Golang import paths
Go
228
star
16

kafka-client

Go client library for Apache Kafka
Go
221
star
17

dosa

DOSA is a data object abstraction layer
Go
197
star
18

cff

Concurrency toolkit for Go
Go
124
star
19

tools

A collection of golang tools used at Uber
Go
58
star
20

go-helix

A Go implementation of Apache Helix (currently the participant part only).
Go
56
star
21

icu4go

A Go binding for the icu4c library
Go
49
star
22

mapdecode

Implement YAML/JSON decoding in one place.
Go
48
star
23

hackeroni

A Go API client for HackerOne (api.hackerone.com)
Go
41
star
24

gwr

Get / Watch / Report -ing of operational data. This project is deprecated and not maintained.
Go
38
star
25

flagoverride

An automatic way of creating command line options to override fields from a struct.
Go
20
star