go get -u github.com/gin-gonic/gin
https://github.com/gin-gonic/gin
go install github.com/gin-gonic/gin@latest
go mod init gindemo01
go mod init Administrator
go mod tidy
go get -u github.com/gin-gonic/gin
go run main.go
PS G:\GO\gin\gindemo01> go run main.go
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
- using env: export GIN_MODE=release
- using code: gin.SetMode(gin.ReleaseMode)
[GIN-debug] GET / --> main.main.func1 (3 handlers)
[GIN-debug] [WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.
Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details.
[GIN-debug] Environment variable PORT is undefined. Using port :8080 by default
[GIN-debug] Listening and serving HTTP on :8080
[GIN] 2025/01/06 - 10:29:16 | 200 | 548.6µs | ::1 | GET "/"
[GIN] 2025/01/06 - 10:29:16 | 404 | 0s | ::1 | GET "/favicon.ico"
[GIN] 2025/01/06 - 10:32:48 | 404 | 0s | ::1 | GET "/new"
// 改完代码以后要重新运行
[GIN-debug] Listening and serving HTTP on :8080
[GIN] 2025/01/06 - 10:34:50 | 200 | 0s | ::1 | GET "/"
[GIN] 2025/01/06 - 10:34:53 | 200 | 0s | ::1 | GET "/new"