<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/go-git.git/src/cmd/vet/testdata, branch dev.debug</title>
<subtitle>github.com: golang/go
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/'/>
<entry>
<title>cmd/vet: add a test for embedded stringer</title>
<updated>2017-05-30T23:57:24+00:00</updated>
<author>
<name>Aliaksandr Valialkin</name>
<email>valyala@gmail.com</email>
</author>
<published>2017-05-29T16:50:24+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=708a01fbf40cfd82675923f88dd306ef6eb17114'/>
<id>708a01fbf40cfd82675923f88dd306ef6eb17114</id>
<content type='text'>
This should help narrowing down the possible cause of #20514.

Updates #20514.

Change-Id: Ie997400c9749aace7783bd585b23dbb4cefc181d
Reviewed-on: https://go-review.googlesource.com/44375
Reviewed-by: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
Reviewed-by: Rob Pike &lt;r@golang.org&gt;
Run-TryBot: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This should help narrowing down the possible cause of #20514.

Updates #20514.

Change-Id: Ie997400c9749aace7783bd585b23dbb4cefc181d
Reviewed-on: https://go-review.googlesource.com/44375
Reviewed-by: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
Reviewed-by: Rob Pike &lt;r@golang.org&gt;
Run-TryBot: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cmd/vet: skip unreachable "if" and "case" code in shift check.</title>
<updated>2017-04-19T20:03:37+00:00</updated>
<author>
<name>Aliaksandr Valialkin</name>
<email>valyala@gmail.com</email>
</author>
<published>2017-03-13T17:17:41+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=78510bd17c35932cd45f1433adb21aeaa0587767'/>
<id>78510bd17c35932cd45f1433adb21aeaa0587767</id>
<content type='text'>
Such dead code is legitimate when dealing with arch-specific
types (int, uint, uintptr).

The CL removes the majority of 'too small for shift' false positives
from such a code.

Change-Id: I62c5635a1d3774ab2d71d3d7056f0589f214cbe5
Reviewed-on: https://go-review.googlesource.com/38065
Run-TryBot: Rob Pike &lt;r@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Rob Pike &lt;r@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Such dead code is legitimate when dealing with arch-specific
types (int, uint, uintptr).

The CL removes the majority of 'too small for shift' false positives
from such a code.

Change-Id: I62c5635a1d3774ab2d71d3d7056f0589f214cbe5
Reviewed-on: https://go-review.googlesource.com/38065
Run-TryBot: Rob Pike &lt;r@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Rob Pike &lt;r@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cmd/vet: make tests safe for perl 5.26</title>
<updated>2017-04-18T22:57:34+00:00</updated>
<author>
<name>Josh Bleecher Snyder</name>
<email>josharian@gmail.com</email>
</author>
<published>2017-04-18T15:39:00+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=2e45310caff101ea7de8873523faab96eb3a87ca'/>
<id>2e45310caff101ea7de8873523faab96eb3a87ca</id>
<content type='text'>
Someday we should write errchk in Go. But not today.

Fixes #20007

Change-Id: I61ccf3cfaa66a710782f8a2212a6a2b4040698da
Reviewed-on: https://go-review.googlesource.com/40950
Run-TryBot: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Rob Pike &lt;r@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Someday we should write errchk in Go. But not today.

Fixes #20007

Change-Id: I61ccf3cfaa66a710782f8a2212a6a2b4040698da
Reviewed-on: https://go-review.googlesource.com/40950
Run-TryBot: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Rob Pike &lt;r@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cmd/vet: check shift calculations with "unsafe" package</title>
<updated>2017-03-13T22:30:27+00:00</updated>
<author>
<name>Aliaksandr Valialkin</name>
<email>valyala@gmail.com</email>
</author>
<published>2017-03-13T16:29:46+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=53937aad99f1d1e177fca3a3d0ec5c83825e015b'/>
<id>53937aad99f1d1e177fca3a3d0ec5c83825e015b</id>
<content type='text'>
vet should properly handle shift calculations via "unsafe"
package after the CL 37950.

Change-Id: I7737f2e656a5166337a17b92db46a0997f2a4e0e
Reviewed-on: https://go-review.googlesource.com/38064
Reviewed-by: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
Run-TryBot: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
vet should properly handle shift calculations via "unsafe"
package after the CL 37950.

Change-Id: I7737f2e656a5166337a17b92db46a0997f2a4e0e
Reviewed-on: https://go-review.googlesource.com/38064
Reviewed-by: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
Run-TryBot: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cmd/vet: eliminate "might be too small for shift" warnings</title>
<updated>2017-03-11T15:29:30+00:00</updated>
<author>
<name>Aliaksandr Valialkin</name>
<email>valyala@gmail.com</email>
</author>
<published>2017-03-08T09:36:30+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=6bc593805f2c2b0ef8b194cc186b804237744cb4'/>
<id>6bc593805f2c2b0ef8b194cc186b804237744cb4</id>
<content type='text'>
Determine int, uint and uintptr bit sizes from GOARCH environment
variable if it is set. Otherwise use host-specific sizes.

Fixes #19321

Change-Id: I494b8e4b49b59d32794f50ff2ce06ba040cb8460
Reviewed-on: https://go-review.googlesource.com/37950
Run-TryBot: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
Reviewed-by: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Determine int, uint and uintptr bit sizes from GOARCH environment
variable if it is set. Otherwise use host-specific sizes.

Fixes #19321

Change-Id: I494b8e4b49b59d32794f50ff2ce06ba040cb8460
Reviewed-on: https://go-review.googlesource.com/37950
Run-TryBot: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
Reviewed-by: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cmd/vet: allow shifts by amounts calculated using unsafe</title>
<updated>2017-02-28T19:13:18+00:00</updated>
<author>
<name>Josh Bleecher Snyder</name>
<email>josharian@gmail.com</email>
</author>
<published>2017-02-28T18:29:58+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=d99d5f7caa10b679f8509c22aafb35a51ab716ae'/>
<id>d99d5f7caa10b679f8509c22aafb35a51ab716ae</id>
<content type='text'>
The real world code that inspired this fix,
from runtime/pprof/map.go:

	// Compute hash of (stk, tag).
	h := uintptr(0)
	for _, x := range stk {
		h = h&lt;&lt;8 | (h &gt;&gt; (8 * (unsafe.Sizeof(h) - 1)))
		h += uintptr(x) * 41
	}
	h = h&lt;&lt;8 | (h &gt;&gt; (8 * (unsafe.Sizeof(h) - 1)))
	h += uintptr(tag) * 41

Change-Id: I99a95b97cba73811faedb0b9a1b9b54e9a1784a3
Reviewed-on: https://go-review.googlesource.com/37574
Run-TryBot: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The real world code that inspired this fix,
from runtime/pprof/map.go:

	// Compute hash of (stk, tag).
	h := uintptr(0)
	for _, x := range stk {
		h = h&lt;&lt;8 | (h &gt;&gt; (8 * (unsafe.Sizeof(h) - 1)))
		h += uintptr(x) * 41
	}
	h = h&lt;&lt;8 | (h &gt;&gt; (8 * (unsafe.Sizeof(h) - 1)))
	h += uintptr(tag) * 41

Change-Id: I99a95b97cba73811faedb0b9a1b9b54e9a1784a3
Reviewed-on: https://go-review.googlesource.com/37574
Run-TryBot: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cmd/vet: include function name or value in copylock message</title>
<updated>2017-01-03T19:23:23+00:00</updated>
<author>
<name>Rob Pike</name>
<email>r@golang.org</email>
</author>
<published>2016-12-24T21:51:21+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=d698e614a21cd50055c7c5e7100069d2bcdb9b83'/>
<id>d698e614a21cd50055c7c5e7100069d2bcdb9b83</id>
<content type='text'>
Given
	var t struct{ lock sync.Mutex }
	var fntab []func(t)
	f(a(), b(&amp;t), c(), fntab[0](t))

Before:
	function call copies lock value: struct{lock sync.Mutex} contains sync.Mutex

After:
	call of fntab[0] copies lock value: struct{lock sync.Mutex} contains sync.Mutex

This will make diagnosis easier when there are multiple function calls per line.

Change-Id: I9881713c5671b847b84a0df0115f57e7cba17d72
Reviewed-on: https://go-review.googlesource.com/34730
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Given
	var t struct{ lock sync.Mutex }
	var fntab []func(t)
	f(a(), b(&amp;t), c(), fntab[0](t))

Before:
	function call copies lock value: struct{lock sync.Mutex} contains sync.Mutex

After:
	call of fntab[0] copies lock value: struct{lock sync.Mutex} contains sync.Mutex

This will make diagnosis easier when there are multiple function calls per line.

Change-Id: I9881713c5671b847b84a0df0115f57e7cba17d72
Reviewed-on: https://go-review.googlesource.com/34730
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cmd/vet: fix copylocks false positive on len(array) and cap(array).</title>
<updated>2016-12-24T21:41:34+00:00</updated>
<author>
<name>Aliaksandr Valialkin</name>
<email>valyala@gmail.com</email>
</author>
<published>2016-12-19T17:28:17+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=d160982a2ef9193384fb3c66939db0fb37a21ba3'/>
<id>d160982a2ef9193384fb3c66939db0fb37a21ba3</id>
<content type='text'>
This is a follow-up for https://golang.org/cl/24340.

Updates #14664.
Fixes #18374.

Change-Id: I2831556a9014d30ec70d5f91943d18c33db5b390
Reviewed-on: https://go-review.googlesource.com/34630
Reviewed-by: Rob Pike &lt;r@golang.org&gt;
Run-TryBot: Rob Pike &lt;r@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is a follow-up for https://golang.org/cl/24340.

Updates #14664.
Fixes #18374.

Change-Id: I2831556a9014d30ec70d5f91943d18c33db5b390
Reviewed-on: https://go-review.googlesource.com/34630
Reviewed-by: Rob Pike &lt;r@golang.org&gt;
Run-TryBot: Rob Pike &lt;r@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cmd/vet: avoid crash in cgo test on recursive type</title>
<updated>2016-12-21T04:29:31+00:00</updated>
<author>
<name>Ian Lance Taylor</name>
<email>iant@golang.org</email>
</author>
<published>2016-12-21T02:16:17+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=27fb26c77c0374ec1876223593078e4d6b98d4f0'/>
<id>27fb26c77c0374ec1876223593078e4d6b98d4f0</id>
<content type='text'>
This CL also re-enables the cgo tests that were accidentally disabled
in CL 32754.

Fixes #18389.

Change-Id: I2fdc4fe3ec1f92b7da3db3fa66f4e0f806fc899f
Reviewed-on: https://go-review.googlesource.com/34660
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This CL also re-enables the cgo tests that were accidentally disabled
in CL 32754.

Fixes #18389.

Change-Id: I2fdc4fe3ec1f92b7da3db3fa66f4e0f806fc899f
Reviewed-on: https://go-review.googlesource.com/34660
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cmd/vet: fix panic and handling of XML in struct field tag check</title>
<updated>2016-12-13T03:13:24+00:00</updated>
<author>
<name>Tilman Dilo</name>
<email>tilman.dilo@gmail.com</email>
</author>
<published>2016-12-05T22:32:08+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go-git.git/commit/?id=1657d76d5bcb7beda816c2b7597262e1ee4fd9af'/>
<id>1657d76d5bcb7beda816c2b7597262e1ee4fd9af</id>
<content type='text'>
The check for duplicate struct field tags introduced in CL 16704
triggers a panic when an anonymous struct field with a duplicate name
is encountered. For such a field, the names slice of the ast.Field is
nil but accessed regardless to generate the warning message.

Additionally, the check produces false positives for XML tags in some
cases:

- When fields are encoded as XML attributes, a warning is produced when
  an attribute reuses a name previously used for an element.

  Example:
    type Foo struct {
        First int `xml:"a"`
        NoDup int `xml:"a,attr"` // warning about reuse of "a"
    }

- When XMLName is used to set the name of the enclosing struct element,
  it is treated as a regular struct field.

  Example:
    type Bar struct {
        XMLName xml.Name `xml:"a"`
        NoDup   int      `xml:"a"` // warning about reuse of "a"
    }

This commit addresses all three issues. The panic is avoided by using
the type name instead of the field name for anonymous struct fields when
generating the warning message. An additional namespace for checking XML
attribute names separately from element names is introduced. Lastly,
fields named XMLName are excluded from the check for duplicate tags.

Updates #18256

Change-Id: Ida48ea8584b56bd4d12ae3ebd588a66ced2594cc
Reviewed-on: https://go-review.googlesource.com/34070
Run-TryBot: Rob Pike &lt;r@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Rob Pike &lt;r@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The check for duplicate struct field tags introduced in CL 16704
triggers a panic when an anonymous struct field with a duplicate name
is encountered. For such a field, the names slice of the ast.Field is
nil but accessed regardless to generate the warning message.

Additionally, the check produces false positives for XML tags in some
cases:

- When fields are encoded as XML attributes, a warning is produced when
  an attribute reuses a name previously used for an element.

  Example:
    type Foo struct {
        First int `xml:"a"`
        NoDup int `xml:"a,attr"` // warning about reuse of "a"
    }

- When XMLName is used to set the name of the enclosing struct element,
  it is treated as a regular struct field.

  Example:
    type Bar struct {
        XMLName xml.Name `xml:"a"`
        NoDup   int      `xml:"a"` // warning about reuse of "a"
    }

This commit addresses all three issues. The panic is avoided by using
the type name instead of the field name for anonymous struct fields when
generating the warning message. An additional namespace for checking XML
attribute names separately from element names is introduced. Lastly,
fields named XMLName are excluded from the check for duplicate tags.

Updates #18256

Change-Id: Ida48ea8584b56bd4d12ae3ebd588a66ced2594cc
Reviewed-on: https://go-review.googlesource.com/34070
Run-TryBot: Rob Pike &lt;r@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Rob Pike &lt;r@golang.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
