Skip to content

Commit

Permalink
archive/tar: remore redundant parens in type expressions
Browse files Browse the repository at this point in the history
Simplify `(T)` expressions to  `T` where possible.

Found using https://go-critic.github.io/overview.html#typeUnparen-ref

Change-Id: Ic5ef335e03898f9fea1ff90fd83956376657fe67
Reviewed-on: https://go-review.googlesource.com/123379
Run-TryBot: Iskander Sharipov <[email protected]>
Run-TryBot: Joe Tsai <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Joe Tsai <[email protected]>
  • Loading branch information
Iskander Sharipov authored and dsnet committed Aug 21, 2018
1 parent 692307a commit 89d533e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/archive/tar/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func (b *block) V7() *headerV7 { return (*headerV7)(b) }
func (b *block) GNU() *headerGNU { return (*headerGNU)(b) }
func (b *block) STAR() *headerSTAR { return (*headerSTAR)(b) }
func (b *block) USTAR() *headerUSTAR { return (*headerUSTAR)(b) }
func (b *block) Sparse() sparseArray { return (sparseArray)(b[:]) }
func (b *block) Sparse() sparseArray { return sparseArray(b[:]) }

// GetFormat checks that the block is a valid tar header based on the checksum.
// It then attempts to guess the specific format based on magic values.
Expand Down Expand Up @@ -263,7 +263,7 @@ func (h *headerGNU) DevMajor() []byte { return h[329:][:8] }
func (h *headerGNU) DevMinor() []byte { return h[337:][:8] }
func (h *headerGNU) AccessTime() []byte { return h[345:][:12] }
func (h *headerGNU) ChangeTime() []byte { return h[357:][:12] }
func (h *headerGNU) Sparse() sparseArray { return (sparseArray)(h[386:][:24*4+1]) }
func (h *headerGNU) Sparse() sparseArray { return sparseArray(h[386:][:24*4+1]) }
func (h *headerGNU) RealSize() []byte { return h[483:][:12] }

type headerSTAR [blockSize]byte
Expand Down Expand Up @@ -293,7 +293,7 @@ func (h *headerUSTAR) Prefix() []byte { return h[345:][:155] }

type sparseArray []byte

func (s sparseArray) Entry(i int) sparseElem { return (sparseElem)(s[i*24:]) }
func (s sparseArray) Entry(i int) sparseElem { return sparseElem(s[i*24:]) }
func (s sparseArray) IsExtended() []byte { return s[24*s.MaxEntries():][:1] }
func (s sparseArray) MaxEntries() int { return len(s) / 24 }

Expand Down

0 comments on commit 89d533e

Please sign in to comment.