FAQ
Not disagreeing with it, not worrying about it... just trying to understand
it :)

Egon, thanks for the tip on filepath.Join :)
On Thu, May 19, 2016 at 2:47 AM, Axel Wagner wrote:

I know that this sounds stupid, but: The whole point of gofmt is to not
worry about such things. The tautologically correct way to do it is the way
gofmt formats it, because that's how gofmt formats it.

Or, as it has been put before: gofmt's style is no ones favorite, yet
gofmt is everyone's favorite :) Disagreeing with gofmt is fine, but
worrying about it is a waste of time.
On Wed, May 18, 2016 at 6:35 AM, simran wrote:

Hi All,

A simplified version of some of my code goes something like:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
package main

func main() {
dir := ""
entry := ""
files := GetFiles(*dir + "/" + entry*)

finalFilenamesWithPath := append(finalFilenamesWithPath,
*dir+"/"+entry*)

_ = finalFilenamesWithPath
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

When i run a "go fmt" on the file, it insists on putting spaces around
the + and "/" in the GetFiles func call, but in the append func call, it
insists on taking the spaces away.

That is, in GetFiles i end up getting:

*dir + "/" + entry*
and in append i end up getting:
*dir+"/"+entry*

Functionally they work fine, but i found it odd that "go fmt" was
insisting on sometimes putting spaces around string concatenation, and
sometimes insisting on taking it away.

Just wondering if there is a pattern i am missing... should string
concatenation have spaces around it or not? :) what are the rules that
govern such formatting?

cheers,

simran.



--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 5 of 5 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMay 18, '16 at 4:36a
activeMay 19, '16 at 2:33a
posts5
users4
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase