github.com/jacobsoderblom/buffalo@v0.11.0/buffalo/cmd/updater/deprecations.go (about) 1 package updater 2 3 import ( 4 "bytes" 5 "fmt" 6 "io/ioutil" 7 "os" 8 "path/filepath" 9 10 "github.com/pkg/errors" 11 ) 12 13 // DeprecrationsCheck will either log, or fix, deprecated items in the application 14 func DeprecrationsCheck(r *Runner) error { 15 fmt.Println("~~~ Checking for deprecations ~~~") 16 b, err := ioutil.ReadFile("main.go") 17 if err != nil { 18 return errors.WithStack(err) 19 } 20 if bytes.Contains(b, []byte("app.Start")) { 21 r.Warnings = append(r.Warnings, "app.Start has been removed in v0.11.0. Use app.Serve Instead. [main.go]") 22 } 23 24 return filepath.Walk(filepath.Join(r.App.Root, "actions"), func(path string, info os.FileInfo, err error) error { 25 if info.IsDir() { 26 return nil 27 } 28 29 if filepath.Ext(path) != ".go" { 30 return nil 31 } 32 33 b, err := ioutil.ReadFile(path) 34 if err != nil { 35 return errors.WithStack(err) 36 } 37 if bytes.Contains(b, []byte("Websocket()")) { 38 r.Warnings = append(r.Warnings, fmt.Sprintf("buffalo.Context#Websocket has been deprecated in v0.11.0. Use github.com/gorilla/websocket directly. [%s]", path)) 39 } 40 41 return nil 42 }) 43 }