diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-08-17 20:26:52 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-08-17 22:41:05 -0600 |
commit | 273890421b31aa7b43d778e4da3de16659e77d73 (patch) | |
tree | a46cd884fe2132a6c69d7d1f9c8ddc84509b4afa | |
parent | 6fc662d5faa238cc71d06c2c888858747c55c55a (diff) |
tools: Upgrade to Go 1.19
1. Edit Makefile:goversion
2. Run `make go-mod-tidy`
3. Run `gofmt -s -w .`
4. Look at the ignore-whitespace-change diff and fixup band gofmt changes
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | go.mod | 4 | ||||
-rw-r--r-- | lib/btrfs/btrfsitem/item_dir.go | 4 | ||||
-rw-r--r-- | lib/btrfs/io3_btree.go | 80 | ||||
-rw-r--r-- | lib/btrfsprogs/btrfsutil/broken_btree.go | 16 | ||||
-rw-r--r-- | lib/containers/rbtree.go | 20 | ||||
-rw-r--r-- | lib/fmtutil/fmt.go | 14 | ||||
-rw-r--r-- | lib/slices/sliceutil.go | 32 | ||||
-rw-r--r-- | tools/src/golangci-lint/go.mod | 2 |
9 files changed, 87 insertions, 87 deletions
@@ -46,7 +46,7 @@ tools/bin/%: tools/src/%/pin.go tools/src/%/go.mod # go mod tidy -goversion = 1.18 +goversion = 1.19 go-mod-tidy: .PHONY: go-mod-tidy @@ -4,11 +4,12 @@ module git.lukeshu.com/btrfs-progs-ng -go 1.18 +go 1.19 require ( github.com/datawire/dlib v1.3.0 github.com/datawire/ocibuild v0.0.3-0.20220423003204-fc6a4e9f90dc + github.com/davecgh/go-spew v1.1.1 github.com/hashicorp/golang-lru v0.5.4 github.com/jacobsa/fuse v0.0.0-20220702091825-13117049f383 github.com/sirupsen/logrus v1.8.1 @@ -20,7 +21,6 @@ require ( ) require ( - github.com/davecgh/go-spew v1.1.1 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect diff --git a/lib/btrfs/btrfsitem/item_dir.go b/lib/btrfs/btrfsitem/item_dir.go index 2fb2d41..9df1b8d 100644 --- a/lib/btrfs/btrfsitem/item_dir.go +++ b/lib/btrfs/btrfsitem/item_dir.go @@ -21,8 +21,8 @@ func NameHash(dat []byte) uint64 { // key.objectid = inode of directory containing this entry // key.offset = -// for DIR_ITEM and XATTR_ITEM = NameHash(name) -// for DIR_INDEX = index id in the directory (starting at 2, because "." and "..") +// - for DIR_ITEM and XATTR_ITEM = NameHash(name) +// - for DIR_INDEX = index id in the directory (starting at 2, because "." and "..") type DirEntry struct { // DIR_ITEM=84 DIR_INDEX=96 XATTR_ITEM=24 Location internal.Key `bin:"off=0x0, siz=0x11"` TransID int64 `bin:"off=0x11, siz=8"` diff --git a/lib/btrfs/io3_btree.go b/lib/btrfs/io3_btree.go index 73f9804..2efef89 100644 --- a/lib/btrfs/io3_btree.go +++ b/lib/btrfs/io3_btree.go @@ -66,52 +66,52 @@ var _ Trees = (*FS)(nil) // - The first element will always have an ItemIdx of -1. // -// - For .Item() callbacks, the last element will always have a -// NodeAddr of 0. +// - For .Item() callbacks, the last element will always have a +// NodeAddr of 0. // // For example, given the tree structure // -// [superblock] -// | -// | <------------------------------------------ pathElem={idx:-1, addr:0x01, lvl:3} -// | -// +[0x01]-----------+ -// | lvl=3 | -// +-+-+-+-+-+-+-+-+-+ -// |1|2|3|4|5|6|7|8|9| -// +---+---+---+---+-+ -// | -// | <------------------------------ pathElem={idx:8, addr:0x02, lvl:2} -// | -// +[0x02]-----------+ -// | lvl=2 | -// +-+-+-+-+-+-+-+-+-+ -// |1|2|3|4|5|6|7|8|9| -// +---+---+---+---+-+ -// | -// | <-------------------- pathElem={idx:7, addr:0x03, lvl:1} -// | -// +[0x03]-----------+ -// | lvl=1 | -// +-+-+-+-+-+-+-+-+-+ -// |1|2|3|4|5|6|7|8|9| -// +---+---+---+---+-+ -// | -// | <---------------- pathElem={idx:4, addr:0x04, lvl:0} -// | -// +[0x04]-----------+ -// | lvl=0 | -// +-+-+-+-+-+-+-+-+-+ -// |1|2|3|4|5|6|7|8|9| -// +---+---+---+---+-+ -// | -// | <--------------- pathElem={idx:5, addr:0, lvl:0} -// | -// [item] +// [superblock] +// | +// | <------------------------------------------ pathElem={idx:-1, addr:0x01, lvl:3} +// | +// +[0x01]-----------+ +// | lvl=3 | +// +-+-+-+-+-+-+-+-+-+ +// |1|2|3|4|5|6|7|8|9| +// +---+---+---+---+-+ +// | +// | <------------------------------ pathElem={idx:8, addr:0x02, lvl:2} +// | +// +[0x02]-----------+ +// | lvl=2 | +// +-+-+-+-+-+-+-+-+-+ +// |1|2|3|4|5|6|7|8|9| +// +---+---+---+---+-+ +// | +// | <-------------------- pathElem={idx:7, addr:0x03, lvl:1} +// | +// +[0x03]-----------+ +// | lvl=1 | +// +-+-+-+-+-+-+-+-+-+ +// |1|2|3|4|5|6|7|8|9| +// +---+---+---+---+-+ +// | +// | <---------------- pathElem={idx:4, addr:0x04, lvl:0} +// | +// +[0x04]-----------+ +// | lvl=0 | +// +-+-+-+-+-+-+-+-+-+ +// |1|2|3|4|5|6|7|8|9| +// +---+---+---+---+-+ +// | +// | <--------------- pathElem={idx:5, addr:0, lvl:0} +// | +// [item] // // the path would be // -// {-1, 0x01, 3}→{8, 0x02, 2}→{7, 0x03, 1}→{4, 0x04, 0}→{2, 0, 0} +// {-1, 0x01, 3}→{8, 0x02, 2}→{7, 0x03, 1}→{4, 0x04, 0}→{2, 0, 0} type TreePath struct { TreeID ObjID Nodes []TreePathElem diff --git a/lib/btrfsprogs/btrfsutil/broken_btree.go b/lib/btrfsprogs/btrfsutil/broken_btree.go index 7fc812d..0d71cfb 100644 --- a/lib/btrfsprogs/btrfsutil/broken_btree.go +++ b/lib/btrfsprogs/btrfsutil/broken_btree.go @@ -108,14 +108,14 @@ var _ btrfs.Trees = (*brokenTrees)(nil) // // Of the btrfs.FS.Tree{Verb}Trees methods: // -// - TreeWalk works on broken trees -// - TreeLookup relies on the tree being properly ordered (which a -// broken tree might not be). -// - TreeSearch relies on the tree being properly ordered (which a -// broken tree might not be). -// - TreeSearchAll relies on the tree being properly ordered (which a -// broken tree might not be), and a bad node may cause it to not -// return a truncated list of results. +// - TreeWalk works on broken trees +// - TreeLookup relies on the tree being properly ordered (which a +// broken tree might not be). +// - TreeSearch relies on the tree being properly ordered (which a +// broken tree might not be). +// - TreeSearchAll relies on the tree being properly ordered (which a +// broken tree might not be), and a bad node may cause it to not +// return a truncated list of results. // // NewBrokenTrees attempts to remedy these deficiencies by using // .TreeWalk to build an out-of-FS index of all of the items in the diff --git a/lib/containers/rbtree.go b/lib/containers/rbtree.go index 0eef553..36da29d 100644 --- a/lib/containers/rbtree.go +++ b/lib/containers/rbtree.go @@ -63,16 +63,16 @@ func (node *RBNode[V]) walk(fn func(*RBNode[V]) error) error { // means to go left on the tree (the value is too high), >0 means to // go right on th etree (the value is too low). // -// +-----+ -// | v=8 | == 0 : this is it -// +-----+ -// / \ -// / \ -// <0 : go left >0 : go right -// / \ -// +---+ +---+ -// | 7 | | 9 | -// +---+ +---+ +// +-----+ +// | v=8 | == 0 : this is it +// +-----+ +// / \ +// / \ +// <0 : go left >0 : go right +// / \ +// +---+ +---+ +// | 7 | | 9 | +// +---+ +---+ // // Returns nil if no such value is found. // diff --git a/lib/fmtutil/fmt.go b/lib/fmtutil/fmt.go index a45ac58..3898046 100644 --- a/lib/fmtutil/fmt.go +++ b/lib/fmtutil/fmt.go @@ -37,15 +37,15 @@ func FmtStateString(st fmt.State, verb rune) string { // fmt.Formatter for []byte or [n]byte types that have a custom string // representation. Use it like: // -// type MyType [16]byte +// type MyType [16]byte // -// func (val MyType) String() string { -// … -// } +// func (val MyType) String() string { +// … +// } // -// func (val MyType) Format(f fmt.State, verb rune) { -// util.FormatByteArrayStringer(val, val[:], f, verb) -// } +// func (val MyType) Format(f fmt.State, verb rune) { +// util.FormatByteArrayStringer(val, val[:], f, verb) +// } func FormatByteArrayStringer( obj interface { fmt.Stringer diff --git a/lib/slices/sliceutil.go b/lib/slices/sliceutil.go index f95c7e7..567f9ec 100644 --- a/lib/slices/sliceutil.go +++ b/lib/slices/sliceutil.go @@ -95,15 +95,15 @@ func max(a, b int) int { // Search the slice for a value for which `fn(slice[i]) = 0`. // -// + + + 0 0 0 - - - -// ^ ^ ^ -// any of +// : + + + 0 0 0 - - - +// : ^ ^ ^ +// : any of // // You can conceptualize `fn` as subtraction: // -// func(straw T) int { -// return needle - straw -// } +// func(straw T) int { +// return needle - straw +// } func Search[T any](slice []T, fn func(T) int) (int, bool) { beg, end := 0, len(slice) for beg < end { @@ -123,14 +123,14 @@ func Search[T any](slice []T, fn func(T) int) (int, bool) { // Search the slice for the left-most value for which `fn(slice[i]) = 0`. // -// + + + 0 0 0 - - - -// ^ +// : + + + 0 0 0 - - - +// : ^ // // You can conceptualize `fn` as subtraction: // -// func(straw T) int { -// return needle - straw -// } +// func(straw T) int { +// return needle - straw +// } func SearchLowest[T any](slice []T, fn func(T) int) (int, bool) { lastBad, firstGood, firstBad := -1, len(slice), len(slice) for lastBad+1 < min(firstGood, firstBad) { @@ -153,14 +153,14 @@ func SearchLowest[T any](slice []T, fn func(T) int) (int, bool) { // Search the slice for the right-most value for which `fn(slice[i]) = 0`. // -// + + + 0 0 0 - - - -// ^ +// : + + + 0 0 0 - - - +// : ^ // // You can conceptualize `fn` as subtraction: // -// func(straw T) int { -// return needle - straw -// } +// func(straw T) int { +// return needle - straw +// } func SearchHighest[T any](slice []T, fn func(T) int) (int, bool) { lastBad, lastGood, firstBad := -1, -1, len(slice) for max(lastBad, lastGood)+1 < firstBad { diff --git a/tools/src/golangci-lint/go.mod b/tools/src/golangci-lint/go.mod index 691487b..9ad3b12 100644 --- a/tools/src/golangci-lint/go.mod +++ b/tools/src/golangci-lint/go.mod @@ -1,6 +1,6 @@ module local -go 1.18 +go 1.19 require github.com/golangci/golangci-lint v1.47.2 |