Skip to content

Commit dd8d425

Browse files
rleungxgopherbot
authored andcommitted
all: fix some lint issues
Make some code more simple. Change-Id: I801adf0dba5f6c515681345c732dbb907f945419 GitHub-Last-Rev: a505146 GitHub-Pull-Request: #49626 Reviewed-on: https://go-review.googlesource.com/c/go/+/364634 Run-TryBot: Ian Lance Taylor <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Keith Randall <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: David Chase <[email protected]>
1 parent df57592 commit dd8d425

File tree

9 files changed

+12
-23
lines changed

9 files changed

+12
-23
lines changed

src/crypto/des/block.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,16 +248,12 @@ func (c *desCipher) generateSubkeys(keyBytes []byte) {
248248
// By doing so, we can have the input blocks (four bits each), and the key blocks (six bits each) well-aligned without
249249
// extra shifts/rotations for alignments.
250250
func unpack(x uint64) uint64 {
251-
var result uint64
252-
253-
result = ((x>>(6*1))&0xff)<<(8*0) |
251+
return ((x>>(6*1))&0xff)<<(8*0) |
254252
((x>>(6*3))&0xff)<<(8*1) |
255253
((x>>(6*5))&0xff)<<(8*2) |
256254
((x>>(6*7))&0xff)<<(8*3) |
257255
((x>>(6*0))&0xff)<<(8*4) |
258256
((x>>(6*2))&0xff)<<(8*5) |
259257
((x>>(6*4))&0xff)<<(8*6) |
260258
((x>>(6*6))&0xff)<<(8*7)
261-
262-
return result
263259
}

src/database/sql/example_cli_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,8 @@ func Example_openDBCLI() {
4949
signal.Notify(appSignal, os.Interrupt)
5050

5151
go func() {
52-
select {
53-
case <-appSignal:
54-
stop()
55-
}
52+
<-appSignal
53+
stop()
5654
}()
5755

5856
Ping(ctx)

src/debug/plan9obj/file.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,7 @@ func walksymtab(data []byte, ptrsz int, fn func(sym) error) error {
216216
p = p[4:]
217217
}
218218

219-
var typ byte
220-
typ = p[0] & 0x7F
219+
typ := p[0] & 0x7F
221220
s.typ = typ
222221
p = p[1:]
223222

src/go/build/constraint/expr.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,6 @@ func (p *exprParser) lex() {
345345
p.i += len(tag)
346346
p.tok = p.s[p.pos:p.i]
347347
p.isTag = true
348-
return
349348
}
350349

351350
// IsPlusBuild reports whether the line of text is a “// +build” constraint.

src/math/tan.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ var _tanP = [...]float64{
6767
}
6868
var _tanQ = [...]float64{
6969
1.00000000000000000000e0,
70-
1.36812963470692954678e4, //0x40cab8a5eeb36572
71-
-1.32089234440210967447e6, //0xc13427bc582abc96
72-
2.50083801823357915839e7, //0x4177d98fc2ead8ef
73-
-5.38695755929454629881e7, //0xc189afe03cbe5a31
70+
1.36812963470692954678e4, // 0x40cab8a5eeb36572
71+
-1.32089234440210967447e6, // 0xc13427bc582abc96
72+
2.50083801823357915839e7, // 0x4177d98fc2ead8ef
73+
-5.38695755929454629881e7, // 0xc189afe03cbe5a31
7474
}
7575

7676
// Tan returns the tangent of the radian argument x.

src/net/http/cookiejar/jar.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,8 @@ func canonicalHost(host string) (string, error) {
303303
return "", err
304304
}
305305
}
306-
if strings.HasSuffix(host, ".") {
307-
// Strip trailing dot from fully qualified domain names.
308-
host = host[:len(host)-1]
309-
}
306+
// Strip trailing dot from fully qualified domain names.
307+
host = strings.TrimSuffix(host, ".")
310308
encoded, err := toASCII(host)
311309
if err != nil {
312310
return "", err

src/net/http/httputil/reverseproxy.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,6 @@ func (p *ReverseProxy) handleUpgradeResponse(rw http.ResponseWriter, req *http.R
622622
go spc.copyToBackend(errc)
623623
go spc.copyFromBackend(errc)
624624
<-errc
625-
return
626625
}
627626

628627
// switchProtocolCopier exists so goroutines proxying data back and

src/runtime/metrics/description_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func TestDescriptionDocs(t *testing.T) {
103103
}
104104
if len(docs) > len(descriptions) {
105105
docsLoop:
106-
for name, _ := range docs {
106+
for name := range docs {
107107
for _, d := range descriptions {
108108
if name == d.Name {
109109
continue docsLoop

src/testing/sub_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ func TestBenchmarkReadMemStatsBeforeFirstRun(t *T) {
724724
var first = true
725725
Benchmark(func(b *B) {
726726
if first && (b.startAllocs == 0 || b.startBytes == 0) {
727-
panic(fmt.Sprintf("ReadMemStats not called before first run"))
727+
panic("ReadMemStats not called before first run")
728728
}
729729
first = false
730730
})

0 commit comments

Comments
 (0)