Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

protectedby

Checks that access to shared resources is protected.

go install github.com/mneverov/protectedby@latest

When a shared resource (field) has a comment with protected by <lock_name>, access to this field will be validated to ensure it is guarded by the specified lock.

See code snippet:

type someStruct struct {
    // i is protected by mu. 
    i int
    mu sync.Mutex
}

func foo() {
    s := someStruct{}
    s.i = 42 // not protected access to shared field i, use s.mu.Lock()
}

For more info see tests.

About

Checks that access to shared resources is protected

Resources

Stars

6 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages