|
| 1 | +#!/bin/sh |
| 2 | +set -e |
| 3 | +for GOFILE in $(find . -name "*.go" | grep -v "./vendor/" ); do |
| 4 | + #First migrate containerd imports to v2 module |
| 5 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_\.a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd(?!\/v2)(\/\S+)?"/$1$2"github.com\/containerd\/containerd\/v2$3"/g' $GOFILE |
| 6 | + |
| 7 | + #Migrate moved packages |
| 8 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_\.a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2"/$1$2"github.com\/containerd\/containerd\/v2\/client"/g' $GOFILE |
| 9 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/content\/local/$1$2"github.com\/containerd\/containerd\/v2\/plugins\/content\/local/g' $GOFILE |
| 10 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/content/$1$2"github.com\/containerd\/containerd\/v2\/core\/content/g' $GOFILE |
| 11 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/containers/$1$2"github.com\/containerd\/containerd\/v2\/core\/containers/g' $GOFILE |
| 12 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/diff\/lcow/$1$2"github.com\/containerd\/containerd\/v2\/plugins\/diff\/lcow/g' $GOFILE |
| 13 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/diff\/walking/$1$2"github.com\/containerd\/containerd\/v2\/plugins\/diff\/walking/g' $GOFILE |
| 14 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/diff\/windows/$1$2"github.com\/containerd\/containerd\/v2\/plugins\/diff\/windows/g' $GOFILE |
| 15 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/diff/$1$2"github.com\/containerd\/containerd\/v2\/core\/diff/g' $GOFILE |
| 16 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/images/$1$2"github.com\/containerd\/containerd\/v2\/core\/images/g' $GOFILE |
| 17 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/leases\/plugin/$1$2"github.com\/containerd\/containerd\/v2\/plugins\/leases/g' $GOFILE |
| 18 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/leases/$1$2"github.com\/containerd\/containerd\/v2\/core\/leases/g' $GOFILE |
| 19 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/metadata\/plugin/$1$2"github.com\/containerd\/containerd\/v2\/plugins\/metadata/g' $GOFILE |
| 20 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/metadata/$1$2"github.com\/containerd\/containerd\/v2\/core\/metadata/g' $GOFILE |
| 21 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/mount/$1$2"github.com\/containerd\/containerd\/v2\/core\/mount/g' $GOFILE |
| 22 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/remotes/$1$2"github.com\/containerd\/containerd\/v2\/core\/remotes/g' $GOFILE |
| 23 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/runtime\/restart\/monitor/$1$2"github.com\/containerd\/containerd\/v2\/plugins\/restart/g' $GOFILE |
| 24 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/sandbox/$1$2"github.com\/containerd\/containerd\/v2\/core\/sandbox/g' $GOFILE |
| 25 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/services\/server/$1$2"github.com\/containerd\/containerd\/v2\/cmd\/containerd\/server/g' $GOFILE |
| 26 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/services/$1$2"github.com\/containerd\/containerd\/v2\/plugins\/services/g' $GOFILE |
| 27 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/snapshots\/blockfile/$1$2"github.com\/containerd\/containerd\/v2\/plugins\/snapshots\/blockfile/g' $GOFILE |
| 28 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/snapshots\/btrfs/$1$2"github.com\/containerd\/containerd\/v2\/plugins\/snapshots\/btrfs/g' $GOFILE |
| 29 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/snapshots\/devmapper/$1$2"github.com\/containerd\/containerd\/v2\/plugins\/snapshots\/devmapper/g' $GOFILE |
| 30 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/snapshots\/lcow/$1$2"github.com\/containerd\/containerd\/v2\/plugins\/snapshots\/lcow/g' $GOFILE |
| 31 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/snapshots\/native/$1$2"github.com\/containerd\/containerd\/v2\/plugins\/snapshots\/native/g' $GOFILE |
| 32 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/snapshots\/overlay/$1$2"github.com\/containerd\/containerd\/v2\/plugins\/snapshots\/overlay/g' $GOFILE |
| 33 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/snapshots\/windows/$1$2"github.com\/containerd\/containerd\/v2\/plugins\/snapshots\/windows/g' $GOFILE |
| 34 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/snapshots/$1$2"github.com\/containerd\/containerd\/v2\/core\/snapshots/g' $GOFILE |
| 35 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/archive/$1$2"github.com\/containerd\/containerd\/v2\/pkg\/archive/g' $GOFILE |
| 36 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/cio/$1$2"github.com\/containerd\/containerd\/v2\/pkg\/cio/g' $GOFILE |
| 37 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/events/$1$2"github.com\/containerd\/containerd\/v2\/pkg\/events/g' $GOFILE |
| 38 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/errdefs/$1$2"github.com\/containerd\/containerd\/v2\/pkg\/errdefs/g' $GOFILE |
| 39 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/filters/$1$2"github.com\/containerd\/containerd\/v2\/pkg\/filters/g' $GOFILE |
| 40 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/gc\/scheduler/$1$2"github.com\/containerd\/containerd\/v2\/plugins\/gc/g' $GOFILE |
| 41 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/gc/$1$2"github.com\/containerd\/containerd\/v2\/pkg\/gc/g' $GOFILE |
| 42 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/identifiers/$1$2"github.com\/containerd\/containerd\/v2\/pkg\/identifiers/g' $GOFILE |
| 43 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/labels/$1$2"github.com\/containerd\/containerd\/v2\/pkg\/labels/g' $GOFILE |
| 44 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/namespaces/$1$2"github.com\/containerd\/containerd\/v2\/pkg\/namespaces/g' $GOFILE |
| 45 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/oci/$1$2"github.com\/containerd\/containerd\/v2\/pkg\/oci/g' $GOFILE |
| 46 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/reference/$1$2"github.com\/containerd\/containerd\/v2\/pkg\/reference/g' $GOFILE |
| 47 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/rootfs/$1$2"github.com\/containerd\/containerd\/v2\/pkg\/rootfs/g' $GOFILE |
| 48 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/sys/$1$2"github.com\/containerd\/containerd\/v2\/pkg\/sys/g' $GOFILE |
| 49 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/tracing/$1$2"github.com\/containerd\/containerd\/v2\/pkg\/tracing/g' $GOFILE |
| 50 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/pkg\/cleanup/$1$2"github.com\/containerd\/containerd\/v2\/internal\/cleanup/g' $GOFILE |
| 51 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/pkg\/failpoint/$1$2"github.com\/containerd\/containerd\/v2\/internal\/failpoint/g' $GOFILE |
| 52 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/pkg\/hasher/$1$2"github.com\/containerd\/containerd\/v2\/internal\/hasher/g' $GOFILE |
| 53 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/pkg\/kmutex/$1$2"github.com\/containerd\/containerd\/v2\/internal\/kmutex/g' $GOFILE |
| 54 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/pkg\/randutil/$1$2"github.com\/containerd\/containerd\/v2\/internal\/randutil/g' $GOFILE |
| 55 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/pkg\/registrar/$1$2"github.com\/containerd\/containerd\/v2\/internal\/registrar/g' $GOFILE |
| 56 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/pkg\/testutil/$1$2"github.com\/containerd\/containerd\/v2\/internal\/testutil/g' $GOFILE |
| 57 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/pkg\/tomlext/$1$2"github.com\/containerd\/containerd\/v2\/internal\/tomlext/g' $GOFILE |
| 58 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/pkg\/truncindex/$1$2"github.com\/containerd\/containerd\/v2\/internal\/truncindex/g' $GOFILE |
| 59 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/metrics/$1$2"github.com\/containerd\/containerd\/v2\/core\/metrics/g' $GOFILE |
| 60 | + perl -pi -e 's/([\t]|[ ]{2,8}|import )([_a-zA-Z0-9]+ )?"github\.com\/containerd\/containerd\/v2\/runtime/$1$2"github.com\/containerd\/containerd\/v2\/core\/runtime/g' $GOFILE |
| 61 | +done |
0 commit comments