diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-03-12 15:17:39 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-03-14 19:45:07 -0600 |
commit | 1be85fecedebe9ea37b910a15a5c45dd2e57649d (patch) | |
tree | f9d4b2e0bf80e96175f789543cb9b2ac27f1484b /lib/btrfsutil/print_addrspace.go | |
parent | 8c8c6c27552f8554ba014c34d684cb90538ef65b (diff) |
Get it to compile with the renamed files
#!/bin/bash
set -e
git ls-files :*.go :!tools/| while read -r file; do
pkgname=${file%/*.go}
pkgname=${pkgname##*/}
if [[ "$pkgname" == btrfs-rec ]]; then
pkgname=main
fi
sed -i "s/^package [^_]*/package ${pkgname}/" "$file"
done
# btrfsutil ####################################################################
gofmt -w -r 'rebuildnodes -> rebuildtrees' cmd lib
gofmt -w -r 'btrees -> btrfsutil' cmd lib
gofmt -w -r 'keyio -> btrfsutil' cmd lib
sed -i 's/func New/func NewGraph/' lib/btrfsutil/graph.go
gofmt -w -r 'graph.New -> btrfsutil.NewGraph' cmd lib
gofmt -w -r 'graph.Graph -> btrfsutil.Graph' cmd lib
sed -i -e '/\/graph"/d' -e 's/pkggraph\.//' lib/btrfsutil/rebuilt_forrest.go
gofmt -w -r 'btrfsutil.BrokenForrest -> BrokenForrest ' lib/btrfsutil
gofmt -w -r 'btrfsutil.Handle -> Handle ' lib/btrfsutil
gofmt -w -r 'btrfsutil.Graph -> Graph ' lib/btrfsutil
gofmt -w -r 'btrfsutil.ItemPtr -> ItemPtr ' lib/btrfsutil
gofmt -w -r 'Handle -> KeyIO' lib/btrfsutil
gofmt -w -r 'btrfsutil.Handle -> btrfsutil.KeyIO' cmd/btrfs-rec/inspect/rebuildtrees/
gofmt -w -r 'NewHandle -> NewKeyIO' cmd lib
# rebuildmappings ##############################################################
gofmt -w -r 'btrfsinspect.DumpTrees -> dumptrees.DumpTrees' cmd lib
gofmt -w -r 'btrfsinspect.MountRO -> mount.MountRO' cmd lib
gofmt -w -r 'btrfsinspect.ScanDevices -> rebuildmappings.ScanDevices' cmd lib
gofmt -w -r 'btrfsinspect.ScanDevicesResult -> rebuildmappings.ScanDevicesResult' cmd lib
gofmt -w -r 'btrfsinspect.SysExtentCSum -> rebuildmappings.SysExtentCSum' cmd lib
gofmt -w -r 'rebuildmappings.IndexAll -> IndexAll ' cmd/btrfs-rec/inspect/rebuildmappings
gofmt -w -r 'rebuildmappings.ScanDevicesResult -> ScanDevicesResult ' cmd/btrfs-rec/inspect/rebuildmappings
gofmt -w -r 'rebuildmappings.SysExtentCSum -> SysExtentCSum ' cmd/btrfs-rec/inspect/rebuildmappings
# btrfscheck ###################################################################
sed -i -e 's/func handle/func Handle/' lib/btrfscheck/graph.go
sed -i 's/handle/btrfscheck.Handle/g' cmd/btrfs-rec/inspect/rebuildtrees/rebuild.go
gofmt -w -r 'fsErr -> FSErr ' lib/btrfscheck cmd/btrfs-rec/inspect/rebuildtrees
gofmt -w -r 'want -> Want ' lib/btrfscheck cmd/btrfs-rec/inspect/rebuildtrees
gofmt -w -r 'wantOff -> WantOff ' lib/btrfscheck cmd/btrfs-rec/inspect/rebuildtrees
gofmt -w -r 'wantDirIndex -> WantDirIndex ' lib/btrfscheck cmd/btrfs-rec/inspect/rebuildtrees
gofmt -w -r 'wantCSum -> WantCSum ' lib/btrfscheck cmd/btrfs-rec/inspect/rebuildtrees
gofmt -w -r 'wantFileExt -> WantFileExt ' lib/btrfscheck cmd/btrfs-rec/inspect/rebuildtrees
# generic imports ##############################################################
replace() {
git grep -l "$1"|xargs -r sed -i "s,$1,$2,g"
}
replace 'lib/btrfsprogs/btrfsinspect/rebuildmappings"' 'cmd/btrfs-rec/inspect/rebuildmappings"'
replace 'lib/btrfsprogs/btrfsinspect/rebuildnodes"' 'cmd/btrfs-rec/inspect/rebuildtrees"'
replace 'lib/btrfsprogs/btrfsutil"' 'lib/btrfsutil"'
goimports -w cmd lib
./tools/bin/golangci-lint run --fix ./...
And then touch-up copyright statements by hand.
Diffstat (limited to 'lib/btrfsutil/print_addrspace.go')
-rw-r--r-- | lib/btrfsutil/print_addrspace.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/btrfsutil/print_addrspace.go b/lib/btrfsutil/print_addrspace.go index e85e055..c9c51f0 100644 --- a/lib/btrfsutil/print_addrspace.go +++ b/lib/btrfsutil/print_addrspace.go @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: GPL-2.0-or-later -package btrfsinspect +package btrfsutil import ( "io" |