为用Go语言编写的Web应用程序设置什么GOARCH?

I want to deploy my webapp (basically CRUD) on DigitalOcean or a similar cloud provider. I found out that I can set GOARCH=386 or GOARCH=amd64. Both build properly on my computer.

How do I decide which one I need to deploy on server? There are all popular options like latest Ubuntu, Debian, CentOS.

Set the one that matches the architecture of your droplet. You can view this on your droplets list. Note that targeting the 386 platform you can run it on both 386 and amd64 platforms, while compiling to amd64 you can only run it on amd64.

If you're asking which to choose, then it's up to you. Know that some operations are faster on amd64 (especially those which use / involve 64-bit values like int64), and also some features of the Go tool are only available if you target the amd64 architecture, for example the race detector, Supported Systems:

The race detector runs on darwin/amd64, freebsd/amd64, linux/amd64, and windows/amd64.

Executable binary size and memory usage is somewhat bigger for amd64, but it's not really an issue in case of Go, as a simple, running Go web server uses like 8 MB of memory. Unless you use excessively large arrays / slices like [big_number]int of course, as the size of int will be 4 bytes on 386 and 8 bytes on amd64.