diff --git a/cmd/fs.go b/cmd/fs.go index 0c39e2aea..5854539d0 100644 --- a/cmd/fs.go +++ b/cmd/fs.go @@ -6,7 +6,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "log" "os" "path" @@ -50,7 +49,7 @@ func (fs *FSHelper) FileExists(path string) bool { // FindFile returns the first occurrence of match inside path. func (fs *FSHelper) FindFile(path, match string) (string, error) { - files, err := ioutil.ReadDir(path) + files, err := os.ReadDir(path) if err != nil { return "", err } @@ -69,7 +68,7 @@ func (fs *FSHelper) FindFile(path, match string) (string, error) { func (fs *FSHelper) CreateFile(filename string, data []byte) error { // Ensure directory exists fs.MkDirs(filepath.Dir(filename)) - return ioutil.WriteFile(filename, data, 0644) + return os.WriteFile(filename, data, 0644) } // MkDirs creates the given nested directories. @@ -156,14 +155,14 @@ func (fs *FSHelper) LoadRelativeFile(relativePath string) ([]byte, error) { if err != nil { return nil, err } - return ioutil.ReadFile(fullPath) + return os.ReadFile(fullPath) } // GetSubdirs will return a list of FQPs to subdirectories in the given directory func (d *Dir) GetSubdirs() (map[string]string, error) { // Read in the directory information - fileInfo, err := ioutil.ReadDir(d.fullPath) + fileInfo, err := os.ReadDir(d.fullPath) if err != nil { return nil, err } @@ -215,7 +214,7 @@ func (fs *FSHelper) SaveAsJSON(data interface{}, filename string) error { e.SetIndent("", " ") e.Encode(data) - err := ioutil.WriteFile(filename, buf.Bytes(), 0755) + err := os.WriteFile(filename, buf.Bytes(), 0755) if err != nil { return err } @@ -231,7 +230,7 @@ func (fs *FSHelper) LoadAsString(filename string) (string, error) { // LoadAsBytes returns the contents of the file as a byte slice func (fs *FSHelper) LoadAsBytes(filename string) ([]byte, error) { - return ioutil.ReadFile(filename) + return os.ReadFile(filename) } // FileMD5 returns the md5sum of the given file diff --git a/cmd/github.go b/cmd/github.go index c71c00c5b..a048a17f4 100644 --- a/cmd/github.go +++ b/cmd/github.go @@ -3,7 +3,7 @@ package cmd import ( "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "sort" ) @@ -28,7 +28,7 @@ func (g *GitHubHelper) GetVersionTags() ([]*SemanticVersion, error) { if err != nil { return result, err } - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return result, err } diff --git a/cmd/linux.go b/cmd/linux.go index 902a75b46..a1f976424 100644 --- a/cmd/linux.go +++ b/cmd/linux.go @@ -2,7 +2,6 @@ package cmd import ( "fmt" - "io/ioutil" "net/url" "os" "runtime" @@ -75,7 +74,6 @@ const ( NixOS // Artix linux distribution ArtixLinux - ) // DistroInfo contains all the information relating to a linux distribution @@ -96,7 +94,7 @@ func GetLinuxDistroInfo() *DistroInfo { } _, err := os.Stat("/etc/os-release") if !os.IsNotExist(err) { - osRelease, _ := ioutil.ReadFile("/etc/os-release") + osRelease, _ := os.ReadFile("/etc/os-release") result = parseOsRelease(string(osRelease)) } return result diff --git a/cmd/package.go b/cmd/package.go index 8b213462a..efb1117c7 100644 --- a/cmd/package.go +++ b/cmd/package.go @@ -7,7 +7,6 @@ import ( "fmt" "image" "image/png" - "io/ioutil" "os" "path" "path/filepath" @@ -244,7 +243,7 @@ func (b *PackageHelper) packageOSX(po *ProjectOptions) error { // No - create a new plist from our defaults tmpl := template.New("infoPlist") plistFile := filepath.Join(b.getPackageFileBaseDir(), "info.plist") - infoPlist, err := ioutil.ReadFile(plistFile) + infoPlist, err := os.ReadFile(plistFile) if err != nil { return err } @@ -258,13 +257,13 @@ func (b *PackageHelper) packageOSX(po *ProjectOptions) error { } // Save to the package - err = ioutil.WriteFile(plistFilename, tpl.Bytes(), 0644) + err = os.WriteFile(plistFilename, tpl.Bytes(), 0644) if err != nil { return err } // Also write to project directory for customisation - err = ioutil.WriteFile(customPlist, tpl.Bytes(), 0644) + err = os.WriteFile(customPlist, tpl.Bytes(), 0644) if err != nil { return err } @@ -334,12 +333,12 @@ func (b *PackageHelper) PackageWindows(po *ProjectOptions, cleanUp bool) error { tgtRCFile := filepath.Join(outputDir, basename+".rc") if !b.fs.FileExists(tgtRCFile) { srcRCfile := filepath.Join(b.getPackageFileBaseDir(), "wails.rc") - rcfilebytes, err := ioutil.ReadFile(srcRCfile) + rcfilebytes, err := os.ReadFile(srcRCfile) if err != nil { return err } rcfiledata := strings.Replace(string(rcfilebytes), "$NAME$", basename, -1) - err = ioutil.WriteFile(tgtRCFile, []byte(rcfiledata), 0755) + err = os.WriteFile(tgtRCFile, []byte(rcfiledata), 0755) if err != nil { return err } @@ -387,11 +386,11 @@ func (b *PackageHelper) copyIcon() (string, error) { // Install default icon iconfile := filepath.Join(b.getPackageFileBaseDir(), "icon.png") - iconData, err := ioutil.ReadFile(iconfile) + iconData, err := os.ReadFile(iconfile) if err != nil { return "", err } - err = ioutil.WriteFile(srcIcon, iconData, 0644) + err = os.WriteFile(srcIcon, iconData, 0644) if err != nil { return "", err } diff --git a/cmd/project.go b/cmd/project.go index efe772579..22ecca3c0 100644 --- a/cmd/project.go +++ b/cmd/project.go @@ -3,7 +3,6 @@ package cmd import ( "encoding/json" "fmt" - "io/ioutil" "os" "path/filepath" "runtime" @@ -310,14 +309,14 @@ func (po *ProjectOptions) WriteProjectConfig() error { return err } - return ioutil.WriteFile(targetFile, filedata, 0600) + return os.WriteFile(targetFile, filedata, 0600) } // LoadConfig loads the project configuration file from the // given directory func (po *ProjectOptions) LoadConfig(projectDir string) error { targetFile := filepath.Join(projectDir, "project.json") - rawBytes, err := ioutil.ReadFile(targetFile) + rawBytes, err := os.ReadFile(targetFile) if err != nil { return err } diff --git a/cmd/system.go b/cmd/system.go index 49e4f760f..8a3deeff5 100644 --- a/cmd/system.go +++ b/cmd/system.go @@ -3,7 +3,6 @@ package cmd import ( "encoding/json" "fmt" - "io/ioutil" "log" "os" "path/filepath" @@ -124,7 +123,7 @@ func (s *SystemHelper) setup() error { if err != nil { return err } - err = ioutil.WriteFile(s.wailsSystemConfig, configData, 0755) + err = os.WriteFile(s.wailsSystemConfig, configData, 0755) if err != nil { return err } @@ -207,11 +206,11 @@ func (sc *SystemConfig) Save(filename string) error { } // Write it out to the config file - return ioutil.WriteFile(filename, theJSON, 0644) + return os.WriteFile(filename, theJSON, 0644) } func (sc *SystemConfig) load(filename string) error { - configData, err := ioutil.ReadFile(filename) + configData, err := os.ReadFile(filename) if err != nil { return err } diff --git a/cmd/templates.go b/cmd/templates.go index fe1c68d24..29c3d49f5 100644 --- a/cmd/templates.go +++ b/cmd/templates.go @@ -4,8 +4,8 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" "log" + "os" "path/filepath" "runtime" "strings" @@ -125,7 +125,7 @@ func (t *TemplateHelper) LoadMetadata(dir string) (*TemplateMetadata, error) { if !t.fs.FileExists(templateFile) { return nil, nil } - rawJSON, err := ioutil.ReadFile(templateFile) + rawJSON, err := os.ReadFile(templateFile) if err != nil { return nil, err } diff --git a/cmd/wails/15_migrate.go b/cmd/wails/15_migrate.go index f4c935f77..c2d4def51 100644 --- a/cmd/wails/15_migrate.go +++ b/cmd/wails/15_migrate.go @@ -3,7 +3,6 @@ package main import ( "bufio" "fmt" - "io/ioutil" "log" "os" "path/filepath" @@ -305,7 +304,7 @@ func updateWailsVersion(currentVersion, latestVersion *semver.Version) error { new := fmt.Sprintf("%s v%s", wailsModule, latestVersion) goMod = strings.Replace(goMod, old, new, -1) - err := ioutil.WriteFile(goModFile, []byte(goMod), 0600) + err := os.WriteFile(goModFile, []byte(goMod), 0600) if err != nil { checkSpinner.Error() return err @@ -343,7 +342,7 @@ func patchMainJS() error { newStartLine := `Wails.Init` mainJSContents = strings.Replace(mainJSContents, oldStartLine, newStartLine, -1) - err := ioutil.WriteFile(mainJSFile, []byte(mainJSContents), 0600) + err := os.WriteFile(mainJSFile, []byte(mainJSContents), 0600) if err != nil { checkSpinner.Error() return err diff --git a/cmd/wails/9_issue.go b/cmd/wails/9_issue.go index a58b2938d..ec0efdbb2 100644 --- a/cmd/wails/9_issue.go +++ b/cmd/wails/9_issue.go @@ -2,7 +2,7 @@ package main import ( "fmt" - "io/ioutil" + "io" "net/http" "net/url" "os" @@ -112,7 +112,7 @@ To help you in this process, we will ask for some information, add Go/Wails deta os.Exit(1) } defer resp.Body.Close() - template, _ := ioutil.ReadAll(resp.Body) + template, _ := io.ReadAll(resp.Body) body := string(template) body = "**Description**\n" + (strings.Split(body, "**Description**")[1]) fullURL := "https://github.com/wailsapp/wails/issues/new?" diff --git a/go.mod b/go.mod index 4d289fe39..de1bbf336 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,6 @@ require ( github.com/gorilla/websocket v1.4.1 github.com/jackmordaunt/icns v1.0.0 github.com/kennygrant/sanitize v1.2.4 - github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect github.com/leaanthony/slicer v1.4.0 github.com/leaanthony/spinner v0.5.3 github.com/mattn/go-colorable v0.1.1 // indirect @@ -17,7 +16,6 @@ require ( github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 github.com/pkg/errors v0.8.1 // indirect github.com/sirupsen/logrus v1.8.1 - github.com/stretchr/objx v0.1.1 // indirect github.com/stretchr/testify v1.3.0 // indirect github.com/syossan27/tebata v0.0.0-20180602121909-b283fe4bc5ba golang.org/x/image v0.0.0-20200430140353-33d19683fad8 diff --git a/go.sum b/go.sum index 79a777e39..6883f786a 100644 --- a/go.sum +++ b/go.sum @@ -21,9 +21,6 @@ github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNU github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kennygrant/sanitize v1.2.4 h1:gN25/otpP5vAsO2djbMhF/LQX6R7+O1TB4yv8NzpJ3o= github.com/kennygrant/sanitize v1.2.4/go.mod h1:LGsjYYtgxbetdg5owWB2mpgUL6e2nfw2eObZ0u0qvak= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= -github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/leaanthony/slicer v1.4.0 h1:Q9u4w+UBU4WHjXnEDdz+eRLMKF/rnyosRBiqULnc1J8= @@ -52,12 +49,9 @@ github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= @@ -73,15 +67,12 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20200625001655-4c5254603344 h1:vGXIOMxbNfDTk/aXCmfdLgkrSV+Z2tcbze+pEc3v5W4= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/sys v0.0.0-20180606202747-9527bec2660b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200724161237-0e2f3a69832c h1:UIcGWL6/wpCfyGuJnRFJRurA+yj8RrW7Q6x2YMCXt6c= -golang.org/x/sys v0.0.0-20200724161237-0e2f3a69832c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 h1:2B5p2L5IfGiD7+b9BOoRMC6DgObAVZV+Fsp050NqXik= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= diff --git a/lib/binding/manager.go b/lib/binding/manager.go index e721fc213..70d82ddbf 100644 --- a/lib/binding/manager.go +++ b/lib/binding/manager.go @@ -2,7 +2,6 @@ package binding import ( "fmt" - "io/ioutil" "os" "path/filepath" "reflect" @@ -144,7 +143,7 @@ export {};` dir := filepath.Dir(typescriptDefinitionFilename) os.MkdirAll(dir, 0755) - return ioutil.WriteFile(typescriptDefinitionFilename, []byte(output.String()), 0755) + return os.WriteFile(typescriptDefinitionFilename, []byte(output.String()), 0755) } // bind the given struct method diff --git a/v2/cmd/wails/internal/commands/generate/template/base/main.tmpl.go b/v2/cmd/wails/internal/commands/generate/template/base/main.tmpl.go index 4bec207bd..096fd5fb7 100644 --- a/v2/cmd/wails/internal/commands/generate/template/base/main.tmpl.go +++ b/v2/cmd/wails/internal/commands/generate/template/base/main.tmpl.go @@ -33,10 +33,10 @@ func main() { HideWindowOnClose: false, RGBA: &options.RGBA{255, 255, 255, 255}, Assets: assets, - LogLevel: logger.DEBUG, - OnStartup: app.startup, - OnDomReady: app.domReady, - OnShutdown: app.shutdown, + LogLevel: logger.DEBUG, + OnStartup: app.startup, + OnDomReady: app.domReady, + OnShutdown: app.shutdown, Bind: []interface{}{ app, }, diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates.go b/v2/cmd/wails/internal/commands/initialise/templates/templates.go index e01fecfb4..641916783 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates.go +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates.go @@ -4,15 +4,14 @@ import ( "embed" "encoding/json" "fmt" - "github.com/go-git/go-git/v5" gofs "io/fs" - "io/ioutil" "log" "os" "path/filepath" "runtime" "strings" + "github.com/go-git/go-git/v5" "github.com/pkg/errors" "github.com/leaanthony/debme" @@ -295,7 +294,7 @@ func Install(options *Options) (bool, *Template, error) { // Clones the given uri and returns the temporary cloned directory func gitclone(options *Options) (string, error) { // Create temporary directory - dirname, err := ioutil.TempDir("", "wails-template-*") + dirname, err := os.MkdirTemp("", "wails-template-*") if err != nil { return "", err } diff --git a/v2/go.sum b/v2/go.sum index 168ecea06..dd5e50bc3 100644 --- a/v2/go.sum +++ b/v2/go.sum @@ -132,8 +132,6 @@ github.com/leaanthony/typescriptify-golang-structs v0.1.7 h1:yoznzWzyxkO/iWdlpq+ github.com/leaanthony/typescriptify-golang-structs v0.1.7/go.mod h1:cWtOkiVhMF77e6phAXUcfNwYmMwCJ67Sij24lfvi9Js= github.com/leaanthony/webview2runtime v1.1.0 h1:N0pv55ift8XtqozIp4PNOtRCJ/Qdd/qzx80lUpalS4c= github.com/leaanthony/webview2runtime v1.1.0/go.mod h1:hH9GnWCve3DYzNaPOcPbhHQ7fodXR1QJNsnwixid4Tk= -github.com/leaanthony/winc v0.0.0-20210921073452-54963136bf18 h1:5iOd93PZbpH4Iir8QkC4coFD+zEQEZSIRcjwjTFZkr0= -github.com/leaanthony/winc v0.0.0-20210921073452-54963136bf18/go.mod h1:KEbMsKoznsebyGHwLk5LqkFOxL5uXSRdvpP4+avmAMs= github.com/leaanthony/winc v0.0.0-20211124105230-0330cfc6d50c h1:TiVq07fzkq0QHJNC2WAb3efpM1R0gPcVgdxcvIu7K84= github.com/leaanthony/winc v0.0.0-20211124105230-0330cfc6d50c/go.mod h1:KEbMsKoznsebyGHwLk5LqkFOxL5uXSRdvpP4+avmAMs= github.com/leaanthony/winicon v1.0.0 h1:ZNt5U5dY71oEoKZ97UVwJRT4e+5xo5o/ieKuHuk8NqQ= diff --git a/v2/init.go b/v2/init.go index 50dc23fdb..d6652f014 100644 --- a/v2/init.go +++ b/v2/init.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package wails diff --git a/v2/internal/app/default.go b/v2/internal/app/default.go index 380c251be..31f173cfa 100644 --- a/v2/internal/app/default.go +++ b/v2/internal/app/default.go @@ -1,3 +1,4 @@ +//go:build !desktop && !hybrid && !server && !dev // +build !desktop,!hybrid,!server,!dev package app diff --git a/v2/internal/app/hybrid.go b/v2/internal/app/hybrid.go index 8c95c2879..c9ff11df7 100644 --- a/v2/internal/app/hybrid.go +++ b/v2/internal/app/hybrid.go @@ -1,3 +1,4 @@ +//go:build !server && !desktop && hybrid // +build !server,!desktop,hybrid package app diff --git a/v2/internal/app/preflight_default.go b/v2/internal/app/preflight_default.go index 5508a7748..001970984 100644 --- a/v2/internal/app/preflight_default.go +++ b/v2/internal/app/preflight_default.go @@ -1,4 +1,5 @@ -//+build !windows +//go:build !windows +// +build !windows package app diff --git a/v2/internal/app/preflight_windows.go b/v2/internal/app/preflight_windows.go index 29bbb7a74..f8e994979 100644 --- a/v2/internal/app/preflight_windows.go +++ b/v2/internal/app/preflight_windows.go @@ -1,4 +1,5 @@ -//+build windows +//go:build windows +// +build windows package app diff --git a/v2/internal/assetdb/filesystem.go b/v2/internal/assetdb/filesystem.go index 48acb713f..954d97ca5 100644 --- a/v2/internal/assetdb/filesystem.go +++ b/v2/internal/assetdb/filesystem.go @@ -1,4 +1,6 @@ +//go:build !desktop // +build !desktop + package assetdb import ( diff --git a/v2/internal/ffenestri/ffenestri_client.go b/v2/internal/ffenestri/ffenestri_client.go index 05af2cdf2..ccae46f47 100644 --- a/v2/internal/ffenestri/ffenestri_client.go +++ b/v2/internal/ffenestri/ffenestri_client.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package ffenestri diff --git a/v2/internal/ffenestri/ffenestri_client_windows.go b/v2/internal/ffenestri/ffenestri_client_windows.go index 542fbf79a..fd5b9069b 100644 --- a/v2/internal/ffenestri/ffenestri_client_windows.go +++ b/v2/internal/ffenestri/ffenestri_client_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package ffenestri diff --git a/v2/internal/ffenestri/windows/wv2runtime/browser.go b/v2/internal/ffenestri/windows/wv2runtime/browser.go index 25f19f2e0..d28964d10 100644 --- a/v2/internal/ffenestri/windows/wv2runtime/browser.go +++ b/v2/internal/ffenestri/windows/wv2runtime/browser.go @@ -1,3 +1,4 @@ +//go:build wv2runtime.browser // +build wv2runtime.browser package wv2runtime diff --git a/v2/internal/ffenestri/windows/wv2runtime/download.go b/v2/internal/ffenestri/windows/wv2runtime/download.go index cfb2aa197..85cbdfdc6 100644 --- a/v2/internal/ffenestri/windows/wv2runtime/download.go +++ b/v2/internal/ffenestri/windows/wv2runtime/download.go @@ -1,6 +1,5 @@ -// +build !wv2runtime.error -// +build !wv2runtime.browser -// +build !wv2runtime.embed +//go:build !wv2runtime.error && !wv2runtime.browser && !wv2runtime.embed +// +build !wv2runtime.error,!wv2runtime.browser,!wv2runtime.embed package wv2runtime diff --git a/v2/internal/ffenestri/windows/wv2runtime/embed.go b/v2/internal/ffenestri/windows/wv2runtime/embed.go index 99a472d48..be41f19c0 100644 --- a/v2/internal/ffenestri/windows/wv2runtime/embed.go +++ b/v2/internal/ffenestri/windows/wv2runtime/embed.go @@ -1,3 +1,4 @@ +//go:build wv2runtime.embed // +build wv2runtime.embed package wv2runtime diff --git a/v2/internal/ffenestri/windows/wv2runtime/error.go b/v2/internal/ffenestri/windows/wv2runtime/error.go index f03d8c81c..44d9de28b 100644 --- a/v2/internal/ffenestri/windows/wv2runtime/error.go +++ b/v2/internal/ffenestri/windows/wv2runtime/error.go @@ -1,3 +1,4 @@ +//go:build wv2runtime.error // +build wv2runtime.error package wv2runtime diff --git a/v2/internal/ffenestri/windows_checkboxes.go b/v2/internal/ffenestri/windows_checkboxes.go index e76dfa8ca..32cb417aa 100644 --- a/v2/internal/ffenestri/windows_checkboxes.go +++ b/v2/internal/ffenestri/windows_checkboxes.go @@ -1,14 +1,16 @@ -//+build windows +//go:build windows +// +build windows package ffenestri import ( "fmt" - "github.com/leaanthony/slicer" - "github.com/wailsapp/wails/v2/internal/menumanager" "os" "sync" "text/tabwriter" + + "github.com/leaanthony/slicer" + "github.com/wailsapp/wails/v2/internal/menumanager" ) /* --------------------------------------------------------------------------------- diff --git a/v2/internal/ffenestri/windows_errorhandler_debug.go b/v2/internal/ffenestri/windows_errorhandler_debug.go index 5de8758b6..e7a069044 100644 --- a/v2/internal/ffenestri/windows_errorhandler_debug.go +++ b/v2/internal/ffenestri/windows_errorhandler_debug.go @@ -1,4 +1,5 @@ -//+build windows,debug +//go:build windows && debug +// +build windows,debug package ffenestri diff --git a/v2/internal/ffenestri/windows_errorhandler_production.go b/v2/internal/ffenestri/windows_errorhandler_production.go index 20c9dc9d8..d492e2ffc 100644 --- a/v2/internal/ffenestri/windows_errorhandler_production.go +++ b/v2/internal/ffenestri/windows_errorhandler_production.go @@ -1,3 +1,4 @@ +//go:build windows && !debug // +build windows,!debug package ffenestri diff --git a/v2/internal/ffenestri/windows_menu.go b/v2/internal/ffenestri/windows_menu.go index 384ffb7fe..6dc5099bc 100644 --- a/v2/internal/ffenestri/windows_menu.go +++ b/v2/internal/ffenestri/windows_menu.go @@ -1,4 +1,5 @@ -//+build windows +//go:build windows +// +build windows package ffenestri diff --git a/v2/internal/ffenestri/windows_menu_cache.go b/v2/internal/ffenestri/windows_menu_cache.go index 5b6762d9b..36b37a239 100644 --- a/v2/internal/ffenestri/windows_menu_cache.go +++ b/v2/internal/ffenestri/windows_menu_cache.go @@ -1,4 +1,5 @@ -//+build windows +//go:build windows +// +build windows package ffenestri diff --git a/v2/internal/ffenestri/windows_radiogroup.go b/v2/internal/ffenestri/windows_radiogroup.go index 3f3d349ff..993bc0898 100644 --- a/v2/internal/ffenestri/windows_radiogroup.go +++ b/v2/internal/ffenestri/windows_radiogroup.go @@ -1,4 +1,5 @@ -//+build windows +//go:build windows +// +build windows package ffenestri diff --git a/v2/internal/ffenestri/windows_win32.go b/v2/internal/ffenestri/windows_win32.go index 5942b9bcf..89991df99 100644 --- a/v2/internal/ffenestri/windows_win32.go +++ b/v2/internal/ffenestri/windows_win32.go @@ -1,4 +1,5 @@ -//+build windows +//go:build windows +// +build windows package ffenestri diff --git a/v2/internal/fs/fs.go b/v2/internal/fs/fs.go index 9bb192209..862e003cb 100644 --- a/v2/internal/fs/fs.go +++ b/v2/internal/fs/fs.go @@ -4,7 +4,6 @@ import ( "crypto/md5" "fmt" "io" - "io/ioutil" "os" "path/filepath" "runtime" @@ -126,7 +125,7 @@ func RelativePath(relativepath string, optionalpaths ...string) string { // MustLoadString attempts to load a string and will abort with a fatal message if // something goes wrong func MustLoadString(filename string) string { - data, err := ioutil.ReadFile(filename) + data, err := os.ReadFile(filename) if err != nil { fmt.Printf("FATAL: Unable to load file '%s': %s\n", filename, err.Error()) os.Exit(1) @@ -163,7 +162,7 @@ func MustMD5File(filename string) string { // MustWriteString will attempt to write the given data to the given filename // It will abort the program in the event of a failure func MustWriteString(filename string, data string) { - err := ioutil.WriteFile(filename, []byte(data), 0755) + err := os.WriteFile(filename, []byte(data), 0755) if err != nil { fatal("Unable to write file", filename, ":", err.Error()) os.Exit(1) @@ -244,7 +243,7 @@ func CopyDir(src string, dst string) (err error) { return } - entries, err := ioutil.ReadDir(src) + entries, err := os.ReadDir(src) if err != nil { return } @@ -260,7 +259,7 @@ func CopyDir(src string, dst string) (err error) { } } else { // Skip symlinks. - if entry.Mode()&os.ModeSymlink != 0 { + if entry.Type()&os.ModeSymlink != 0 { continue } @@ -306,7 +305,7 @@ func CopyDirExtended(src string, dst string, ignore []string) (err error) { return } - entries, err := ioutil.ReadDir(src) + entries, err := os.ReadDir(src) if err != nil { return } @@ -325,7 +324,7 @@ func CopyDirExtended(src string, dst string, ignore []string) (err error) { } } else { // Skip symlinks. - if entry.Mode()&os.ModeSymlink != 0 { + if entry.Type()&os.ModeSymlink != 0 { continue } @@ -370,7 +369,7 @@ func MoveDirExtended(src string, dst string, ignore []string) (err error) { return } - entries, err := ioutil.ReadDir(src) + entries, err := os.ReadDir(src) if err != nil { return } @@ -383,7 +382,7 @@ func MoveDirExtended(src string, dst string, ignore []string) (err error) { dstPath := filepath.Join(dst, entry.Name()) // Skip symlinks. - if entry.Mode()&os.ModeSymlink != 0 { + if entry.Type()&os.ModeSymlink != 0 { continue } diff --git a/v2/internal/github/github.go b/v2/internal/github/github.go index e91b296e1..0a5d25714 100644 --- a/v2/internal/github/github.go +++ b/v2/internal/github/github.go @@ -3,7 +3,7 @@ package github import ( "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "sort" "strings" @@ -20,7 +20,7 @@ func GetVersionTags() ([]*SemanticVersion, error) { if err != nil { return result, err } - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return result, err } diff --git a/v2/internal/html/asset.go b/v2/internal/html/asset.go index 4c41358f4..49b5c2abd 100644 --- a/v2/internal/html/asset.go +++ b/v2/internal/html/asset.go @@ -2,9 +2,9 @@ package html import ( "fmt" - "io/ioutil" "log" "net/url" + "os" "path/filepath" "regexp" "strings" @@ -39,7 +39,7 @@ type Asset struct { // Load the asset from disk func (a *Asset) Load(basedirectory string) error { assetpath := filepath.Join(basedirectory, a.Path) - data, err := ioutil.ReadFile(assetpath) + data, err := os.ReadFile(assetpath) if err != nil { return err } diff --git a/v2/internal/html/assetbundle.go b/v2/internal/html/assetbundle.go index 6ec098c7e..1878357ab 100644 --- a/v2/internal/html/assetbundle.go +++ b/v2/internal/html/assetbundle.go @@ -4,7 +4,7 @@ import ( "bytes" "fmt" "io" - "io/ioutil" + "os" "path/filepath" "strings" @@ -189,7 +189,7 @@ func (a *AssetBundle) WriteToCFile(targetDir string) (string, error) { // Save file assetsFile := filepath.Join(targetDir, "assets.h") - err = ioutil.WriteFile(assetsFile, []byte(cdata.String()), 0600) + err = os.WriteFile(assetsFile, []byte(cdata.String()), 0600) if err != nil { return "", err } diff --git a/v2/internal/project/project.go b/v2/internal/project/project.go index 99063d0f4..192f26e7b 100644 --- a/v2/internal/project/project.go +++ b/v2/internal/project/project.go @@ -2,7 +2,6 @@ package project import ( "encoding/json" - "io/ioutil" "os" "path/filepath" "runtime" @@ -77,7 +76,7 @@ func Load(projectPath string) (*Project, error) { // Attempt to load project.json projectFile := filepath.Join(projectPath, "wails.json") - rawBytes, err := ioutil.ReadFile(projectFile) + rawBytes, err := os.ReadFile(projectFile) if err != nil { return nil, err } diff --git a/v2/internal/runtime/scripts/rebuild.go b/v2/internal/runtime/scripts/rebuild.go index b16fe3880..847bce761 100644 --- a/v2/internal/runtime/scripts/rebuild.go +++ b/v2/internal/runtime/scripts/rebuild.go @@ -3,7 +3,6 @@ package main import ( "bytes" "fmt" - "io/ioutil" "log" "os" "strings" @@ -51,7 +50,7 @@ func main() { } wailsJS := fs.RelativePath("../assets/desktop_" + platform + ".js") - runtimeData, err := ioutil.ReadFile(wailsJS) + runtimeData, err := os.ReadFile(wailsJS) if err != nil { log.Fatal(err) } @@ -78,7 +77,7 @@ const unsigned char runtime[]={` // Save file outputFile := fs.RelativePath(fmt.Sprintf("../../ffenestri/runtime_%s.c", platform)) - if err := ioutil.WriteFile(outputFile, []byte(runtimeC), 0600); err != nil { + if err := os.WriteFile(outputFile, []byte(runtimeC), 0600); err != nil { log.Fatal(err) } } diff --git a/v2/internal/system/operatingsystem/os_linux.go b/v2/internal/system/operatingsystem/os_linux.go index 090bba2ac..49e00c02c 100644 --- a/v2/internal/system/operatingsystem/os_linux.go +++ b/v2/internal/system/operatingsystem/os_linux.go @@ -1,10 +1,10 @@ +//go:build linux // +build linux package operatingsystem import ( "fmt" - "io/ioutil" "os" "strings" ) @@ -16,7 +16,7 @@ func platformInfo() (*OS, error) { return nil, fmt.Errorf("unable to read system information") } - osRelease, _ := ioutil.ReadFile("/etc/os-release") + osRelease, _ := os.ReadFile("/etc/os-release") return parseOsRelease(string(osRelease)), nil } diff --git a/v2/internal/system/packagemanager/apt.go b/v2/internal/system/packagemanager/apt.go index cc37e55bb..986ce85d6 100644 --- a/v2/internal/system/packagemanager/apt.go +++ b/v2/internal/system/packagemanager/apt.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package packagemanager diff --git a/v2/internal/system/packagemanager/dnf.go b/v2/internal/system/packagemanager/dnf.go index b7a760f2c..d4561d5d8 100644 --- a/v2/internal/system/packagemanager/dnf.go +++ b/v2/internal/system/packagemanager/dnf.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package packagemanager diff --git a/v2/internal/system/packagemanager/emerge.go b/v2/internal/system/packagemanager/emerge.go index 0caa3117c..7497d580a 100644 --- a/v2/internal/system/packagemanager/emerge.go +++ b/v2/internal/system/packagemanager/emerge.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package packagemanager diff --git a/v2/internal/system/packagemanager/eopkg.go b/v2/internal/system/packagemanager/eopkg.go index 6a7a8fd95..dbeab96de 100644 --- a/v2/internal/system/packagemanager/eopkg.go +++ b/v2/internal/system/packagemanager/eopkg.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package packagemanager diff --git a/v2/internal/system/packagemanager/packagemanager.go b/v2/internal/system/packagemanager/packagemanager.go index 7e15594aa..6bc6784de 100644 --- a/v2/internal/system/packagemanager/packagemanager.go +++ b/v2/internal/system/packagemanager/packagemanager.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package packagemanager diff --git a/v2/internal/system/packagemanager/pacman.go b/v2/internal/system/packagemanager/pacman.go index 6378c324d..1fbecf781 100644 --- a/v2/internal/system/packagemanager/pacman.go +++ b/v2/internal/system/packagemanager/pacman.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package packagemanager diff --git a/v2/internal/system/packagemanager/zypper.go b/v2/internal/system/packagemanager/zypper.go index af9d2e3d1..0d7fb082d 100644 --- a/v2/internal/system/packagemanager/zypper.go +++ b/v2/internal/system/packagemanager/zypper.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package packagemanager diff --git a/v2/pkg/commands/build/base.go b/v2/pkg/commands/build/base.go index 2d247af17..b93aa9b55 100644 --- a/v2/pkg/commands/build/base.go +++ b/v2/pkg/commands/build/base.go @@ -3,7 +3,6 @@ package build import ( "bytes" "fmt" - "io/ioutil" "os" "os/exec" "path/filepath" @@ -87,7 +86,7 @@ func (b *BaseBuilder) buildCustomAssets(projectData *project.Project) error { if len(localPath) == 0 { return nil } - if data, err := ioutil.ReadFile(filepath.Join(customAssetsDir, localPath)); err == nil { + if data, err := os.ReadFile(filepath.Join(customAssetsDir, localPath)); err == nil { assets.AddAsset(localPath, data) } @@ -100,7 +99,7 @@ func (b *BaseBuilder) buildCustomAssets(projectData *project.Project) error { // Write assetdb out to root directory assetsDbFilename := fs.RelativePath("../../../assetsdb.go") b.addFileToDelete(assetsDbFilename) - err = ioutil.WriteFile(assetsDbFilename, []byte(assets.Serialize("assets", "wails")), 0644) + err = os.WriteFile(assetsDbFilename, []byte(assets.Serialize("assets", "wails")), 0644) if err != nil { return err } @@ -108,7 +107,7 @@ func (b *BaseBuilder) buildCustomAssets(projectData *project.Project) error { } func (b *BaseBuilder) convertFileToIntegerString(filename string) (string, error) { - rawData, err := ioutil.ReadFile(filename) + rawData, err := os.ReadFile(filename) if err != nil { return "", err } diff --git a/v2/pkg/commands/build/desktop.go b/v2/pkg/commands/build/desktop.go index 76623c01a..141036b2c 100644 --- a/v2/pkg/commands/build/desktop.go +++ b/v2/pkg/commands/build/desktop.go @@ -2,12 +2,12 @@ package build import ( "fmt" - "github.com/wailsapp/wails/v2/pkg/buildassets" - "io/ioutil" + "os" "path/filepath" "github.com/wailsapp/wails/v2/internal/fs" "github.com/wailsapp/wails/v2/internal/html" + "github.com/wailsapp/wails/v2/pkg/buildassets" ) // DesktopBuilder builds applications for the desktop @@ -138,7 +138,7 @@ func (d *DesktopBuilder) BuildRuntime(options *Options) error { } wailsJS := fs.RelativePath("../../../internal/runtime/assets/desktop.js") - runtimeData, err := ioutil.ReadFile(wailsJS) + runtimeData, err := os.ReadFile(wailsJS) if err != nil { return err } @@ -158,7 +158,7 @@ const unsigned char runtime[]={` // Save file outputFile := fs.RelativePath("../../../internal/ffenestri/runtime.c") - if err := ioutil.WriteFile(outputFile, []byte(runtimeC), 0600); err != nil { + if err := os.WriteFile(outputFile, []byte(runtimeC), 0600); err != nil { return err } diff --git a/v2/pkg/commands/build/desktop_darwin.go b/v2/pkg/commands/build/desktop_darwin.go index bc084f4f4..c253c303f 100644 --- a/v2/pkg/commands/build/desktop_darwin.go +++ b/v2/pkg/commands/build/desktop_darwin.go @@ -1,10 +1,10 @@ +//go:build darwin // +build darwin package build import ( "fmt" - "io/ioutil" "log" "path/filepath" "strconv" @@ -74,7 +74,7 @@ func (d *DesktopBuilder) processTrayIcons(assetDir string, options *Options) err for count, filename := range trayIconFilenames { // Load the tray icon - dataBytes, err = ioutil.ReadFile(filename) + dataBytes, err = os.ReadFile(filename) if err != nil { return err } @@ -109,7 +109,7 @@ func (d *DesktopBuilder) processTrayIcons(assetDir string, options *Options) err } cdata.WriteString("0x00 };\n") - err = ioutil.WriteFile(targetFile, []byte(cdata.String()), 0600) + err = os.WriteFile(targetFile, []byte(cdata.String()), 0600) if err != nil { return err } @@ -168,7 +168,7 @@ func (d *DesktopBuilder) processDialogIcons(assetDir string, options *Options) e for count, filename := range dialogIconFilenames { // Load the tray icon - dataBytes, err = ioutil.ReadFile(filename) + dataBytes, err = os.ReadFile(filename) if err != nil { return err } @@ -203,7 +203,7 @@ func (d *DesktopBuilder) processDialogIcons(assetDir string, options *Options) e } cdata.WriteString("0x00 };\n") - err = ioutil.WriteFile(targetFile, []byte(cdata.String()), 0600) + err = os.WriteFile(targetFile, []byte(cdata.String()), 0600) if err != nil { return err } diff --git a/v2/pkg/commands/build/desktop_linux.go b/v2/pkg/commands/build/desktop_linux.go index 1d94e5ac6..4d84577bf 100644 --- a/v2/pkg/commands/build/desktop_linux.go +++ b/v2/pkg/commands/build/desktop_linux.go @@ -1,10 +1,10 @@ +//go:build linux // +build linux package build import ( "image/png" - "io/ioutil" "os" "path/filepath" "strings" @@ -51,7 +51,7 @@ func (d *DesktopBuilder) compileIcon(assetDir string, iconFile string) error { output = strings.Replace(output, "static char", "const char", 1) // save icon.c - err = ioutil.WriteFile(targetFile, []byte(output), 0755) + err = os.WriteFile(targetFile, []byte(output), 0755) return err } diff --git a/v2/pkg/commands/build/desktop_windows.go b/v2/pkg/commands/build/desktop_windows.go index afb2e011f..d95cb66de 100644 --- a/v2/pkg/commands/build/desktop_windows.go +++ b/v2/pkg/commands/build/desktop_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package build diff --git a/v2/pkg/commands/build/internal/packager/icons/dialog/build.go b/v2/pkg/commands/build/internal/packager/icons/dialog/build.go index 1d4f74f7a..344f30c89 100644 --- a/v2/pkg/commands/build/internal/packager/icons/dialog/build.go +++ b/v2/pkg/commands/build/internal/packager/icons/dialog/build.go @@ -2,12 +2,13 @@ package main import ( "fmt" - "github.com/leaanthony/slicer" - "io/ioutil" "log" + "os" "path/filepath" "strconv" "strings" + + "github.com/leaanthony/slicer" ) func convertToHexLiteral(bytes []byte) string { @@ -56,7 +57,7 @@ func buildMacIcons(dialogIconFilenames []string) error { for count, filename := range dialogIconFilenames { // Load the tray icon - dataBytes, err = ioutil.ReadFile(filename) + dataBytes, err = os.ReadFile(filename) if err != nil { log.Fatal(err) } @@ -91,7 +92,7 @@ func buildMacIcons(dialogIconFilenames []string) error { } cdata.WriteString("0x00 };\n") - err = ioutil.WriteFile(targetFile, []byte(cdata.String()), 0600) + err = os.WriteFile(targetFile, []byte(cdata.String()), 0600) if err != nil { log.Fatal(err) } diff --git a/v2/pkg/commands/build/server.go b/v2/pkg/commands/build/server.go index fd37aebf8..d591c55fc 100644 --- a/v2/pkg/commands/build/server.go +++ b/v2/pkg/commands/build/server.go @@ -2,7 +2,6 @@ package build import ( "fmt" - "io/ioutil" "os" "strings" @@ -73,7 +72,7 @@ func (s *ServerBuilder) BuildBaseAssets(assets *html.AssetBundle) error { // Add wails.js wailsjsPath := fs.RelativePath("../../../internal/runtime/assets/server.js") - if rawData, err := ioutil.ReadFile(wailsjsPath); err == nil { + if rawData, err := os.ReadFile(wailsjsPath); err == nil { db.AddAsset("/wails.js", rawData) } diff --git a/v2/pkg/menu/colours/colours.go b/v2/pkg/menu/colours/colours.go index c0f1da05c..28564a09e 100644 --- a/v2/pkg/menu/colours/colours.go +++ b/v2/pkg/menu/colours/colours.go @@ -4,7 +4,7 @@ import ( "bytes" _ "embed" "encoding/json" - "io/ioutil" + "io" "log" "net/http" "os" @@ -44,7 +44,7 @@ func main() { log.Fatal(err) } defer resp.Body.Close() - data, err := ioutil.ReadAll(resp.Body) + data, err := io.ReadAll(resp.Body) if err != nil { log.Fatal(err) } diff --git a/v2/pkg/parser/generate.go b/v2/pkg/parser/generate.go index b45a524c5..f3f8e3937 100644 --- a/v2/pkg/parser/generate.go +++ b/v2/pkg/parser/generate.go @@ -3,7 +3,6 @@ package parser import ( "bytes" _ "embed" - "io/ioutil" "os" "path/filepath" "text/template" @@ -135,7 +134,7 @@ func generatePackage(pkg *Package, moduledir string) error { } // Save typescript file - err = ioutil.WriteFile(filepath.Join(moduledir, "_"+pkg.Name+".d.ts"), buffer.Bytes(), 0755) + err = os.WriteFile(filepath.Join(moduledir, "_"+pkg.Name+".d.ts"), buffer.Bytes(), 0755) if err != nil { return errors.Wrap(err, "Error writing backend package file") } @@ -156,7 +155,7 @@ func generatePackage(pkg *Package, moduledir string) error { } // Save javascript file - err = ioutil.WriteFile(filepath.Join(moduledir, "_"+pkg.Name+".js"), buffer.Bytes(), 0755) + err = os.WriteFile(filepath.Join(moduledir, "_"+pkg.Name+".js"), buffer.Bytes(), 0755) if err != nil { return errors.Wrap(err, "Error writing backend package file") } @@ -183,7 +182,7 @@ func generateIndexJS(dir string, packages []*Package) error { // Calculate target filename indexJS := filepath.Join(dir, "index.js") - err = ioutil.WriteFile(indexJS, buffer.Bytes(), 0755) + err = os.WriteFile(indexJS, buffer.Bytes(), 0755) if err != nil { return errors.Wrap(err, "Error writing backend package index.js file") } @@ -209,7 +208,7 @@ func generateIndexTS(dir string, packages []*Package) error { // Calculate target filename indexJS := filepath.Join(dir, "index.d.ts") - err = ioutil.WriteFile(indexJS, buffer.Bytes(), 0755) + err = os.WriteFile(indexJS, buffer.Bytes(), 0755) if err != nil { return errors.Wrap(err, "Error writing backend package index.d.ts file") } @@ -236,7 +235,7 @@ func generateGlobalsTS(dir string, packages []*Package) error { // Calculate target filename indexJS := filepath.Join(dir, "globals.d.ts") - err = ioutil.WriteFile(indexJS, buffer.Bytes(), 0755) + err = os.WriteFile(indexJS, buffer.Bytes(), 0755) if err != nil { return errors.Wrap(err, "Error writing backend package globals.d.ts file") }