...

Source file src/cmd/vet/testdata/copylock/copylock.go

Documentation: cmd/vet/testdata/copylock

     1  // Copyright 2018 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package copylock
     6  
     7  import "sync"
     8  
     9  func BadFunc() {
    10  	var x *sync.Mutex
    11  	p := x
    12  	var y sync.Mutex
    13  	p = &y
    14  	*p = *x // ERROR "assignment copies lock value to \*p: sync.Mutex"
    15  }
    16  

View as plain text