FAQ
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.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 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