github.com/hailaz/selfupdate@v0.0.0-20231214083445-ff94a6158680/README.md (about) 1 [![API Reference](https://img.shields.io/badge/api-reference-blue.svg)](https://pkg.go.dev/github.com/minio/selfupdate?tab=doc) [![Apache V2 License](https://img.shields.io/badge/license-Apache%20V2-blue.svg)](https://github.com/hailaz/selfupdate/blob/master/LICENSE) 2 3 # selfupdate: Build self-updating Go programs 4 5 > NOTE: Original work at github.com/inconshreveable/go-update, modified for the needs within MinIO project 6 7 Package update provides functionality to implement secure, self-updating Go programs (or other single-file targets) 8 A program can update itself by replacing its executable file with a new version. 9 10 It provides the flexibility to implement different updating user experiences 11 like auto-updating, or manual user-initiated updates. It also boasts 12 advanced features like binary patching and code signing verification. 13 14 Example of updating from a URL: 15 16 ```go 17 import ( 18 "fmt" 19 "net/http" 20 21 "github.com/minio/selfupdate" 22 ) 23 24 func doUpdate(url string) error { 25 resp, err := http.Get(url) 26 if err != nil { 27 return err 28 } 29 defer resp.Body.Close() 30 err = selfupdate.Apply(resp.Body, selfupdate.Options{}) 31 if err != nil { 32 // error handling 33 } 34 return err 35 } 36 ``` 37 38 ## Features 39 40 - Cross platform support (Windows too!) 41 - Binary patch application 42 - Checksum verification 43 - Code signing verification 44 - Support for updating arbitrary files 45 46 ## License 47 48 This SDK is distributed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0), see LICENSE for more information. Original work was also distributed under the same license.