![]() ![]() This is a well established method in POSIX systems, whereby a program can return a 0-255 integer to indicate if the program ran successfully, and if not, why not.Ī common scenario a back-end web developer might encounter is writing code which uploads a file to an external storage platform, like S3 or Azure. Perhaps at an earlier stage than the end of your code, perhaps with an error code too. Package main import ( "archive/zip" "fmt" "io" "os" ) func main () Įxit an Application, With or Without an Error CodeĮxiting an application in Go happens anyway when the main() function is complete, but the purpose of this post is to show you how to force that to happen.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |