From c2c92fd21d5352e63b81483defea1fdb7425fefa Mon Sep 17 00:00:00 2001 From: Hana Date: Fri, 19 Nov 2021 10:42:18 -0500 Subject: [PATCH] go/callgraph/vta/internal/trie: fix build with go1.12 - Convert shift count to unsigned to make go1.12 happy. https://github.com/golang/proposal/blob/master/design/19113-signed-shift-counts.md - Require go1.13+ for tests that use the new language features introduced in go1.13. https://golang.org/doc/go1.13#language Change-Id: I30dc5ee44ccf1a76ce30f352751316efdebc5929 Reviewed-on: https://go-review.googlesource.com/c/tools/+/365634 Trust: Hyang-Ah Hana Kim Run-TryBot: Hyang-Ah Hana Kim gopls-CI: kokoro TryBot-Result: Go Bot Reviewed-by: Tim King --- go/callgraph/vta/internal/trie/bits.go | 2 +- go/callgraph/vta/internal/trie/bits_test.go | 3 +++ go/callgraph/vta/internal/trie/trie_test.go | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/go/callgraph/vta/internal/trie/bits.go b/go/callgraph/vta/internal/trie/bits.go index c343d29e7c..f2fd0ba836 100644 --- a/go/callgraph/vta/internal/trie/bits.go +++ b/go/callgraph/vta/internal/trie/bits.go @@ -46,7 +46,7 @@ func branchingBit(x, y prefix) bitpos { if p == 0 { return 0 } - return 1 << (bits.Len64(uint64(p)) - 1) + return bitpos(1) << uint(bits.Len64(uint64(p))-1) // uint conversion needed for go1.12 } // zeroBit returns true if k has a 0 bit at position `b`. diff --git a/go/callgraph/vta/internal/trie/bits_test.go b/go/callgraph/vta/internal/trie/bits_test.go index f19acdf384..07784cdffa 100644 --- a/go/callgraph/vta/internal/trie/bits_test.go +++ b/go/callgraph/vta/internal/trie/bits_test.go @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build go1.13 +// +build go1.13 + package trie import ( diff --git a/go/callgraph/vta/internal/trie/trie_test.go b/go/callgraph/vta/internal/trie/trie_test.go index 68abb5b840..c0651b0ef8 100644 --- a/go/callgraph/vta/internal/trie/trie_test.go +++ b/go/callgraph/vta/internal/trie/trie_test.go @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build go1.13 +// +build go1.13 + package trie import (