sample-golang icon indicating copy to clipboard operation
sample-golang copied to clipboard

Clean up `http.ListenAndServe`

Open thinkverse opened this issue 2 years ago • 0 comments

This PR cleans up the http.ListenAndServe if statement by removing the redundant Sprintf call, it's already available from earlier in main. So no need to duplicate it again. https://github.com/digitalocean/sample-golang/blob/0033b3f954ea06f154807969405a2388db74551b/main.go#L121

Also simplified the if statement more by taking advantage of Go's ability to initialize local variables inside if statements.

thinkverse avatar Feb 27 '23 20:02 thinkverse