diff --git a/tools/v3migration/v3Changes.md b/tools/v3migration/v3Changes.md index 1f2f473..85b54c4 100644 --- a/tools/v3migration/v3Changes.md +++ b/tools/v3migration/v3Changes.md @@ -6,7 +6,9 @@ - rename memoryLimitInBbytes JSON key in docker (#464) - fix cgroup filename (#464) - RLimit is now uint64 (#364) -- mem.VirtualMemoryStat JSON fields capitalization and TestX_String tests (#545) +- mem.VirtualMemoryStat JSON fields capitalization (#545) + - various JSON field name and some of Variable name have been changed. see v3migration.sh +- Become private various kind of platform dependent values/constants such as process.GetWin32Proc. ### not yet diff --git a/tools/v3migration/v3migration.go b/tools/v3migration/v3migration.go index 2f39d9c..53ee6e8 100644 --- a/tools/v3migration/v3migration.go +++ b/tools/v3migration/v3migration.go @@ -45,6 +45,37 @@ func issue429() error { return nil } +func issueRemoveUnusedValue() error { + f := func(filename string) error { + fset := token.NewFileSet() + expr, err := parser.ParseFile(fset, filename, nil, parser.ParseComments) + if err != nil { + return err + } + n := astutil.Apply(expr, func(cr *astutil.Cursor) bool { + if cr.Name() == "Decls" { + switch n := cr.Node().(type) { + case *ast.GenDecl: + if n.Tok != token.TYPE { + break + } + ts := n.Specs[0].(*ast.TypeSpec) + if ts.Name.Name == "SystemProcessInformation" { + cr.Delete() + } + } + } + return true + }, nil) + return replace(filename, fset, n) + } + + if err := f("process/process_windows.go"); err != nil { + log.Fatalln("run 429:", err) + } + return nil +} + func replace(filename string, fset *token.FileSet, n ast.Node) error { if err := os.Remove(filename); err != nil { return err @@ -68,6 +99,8 @@ func main() { switch n { case "429": issue429() + case "issueRemoveUnusedValue": + issueRemoveUnusedValue() } } diff --git a/tools/v3migration/v3migration.sh b/tools/v3migration/v3migration.sh index 2d0fda5..b8fc068 100644 --- a/tools/v3migration/v3migration.sh +++ b/tools/v3migration/v3migration.sh @@ -111,8 +111,6 @@ sed -i 's|expect_new|expectNew|g' net/*.go - - # fix no more public API/types/constants defined only for some platforms sed -i 's|CTLKern|ctlKern|g' cpu/*.go @@ -166,6 +164,10 @@ sed -i 's|PageSize|pageSize|g' process/process_*.go sed -i 's|PrioProcess|prioProcess|g' process/process_*.go sed -i 's|ClockTicks|clockTicks|g' process/process_*.go + +./v3migration `pwd` issueRemoveUnusedValue + + ############ SHOULD BE FIXED BY HAND