On Wednesday, 18 May 2016 07:36:35 UTC+3, simran g 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,

_ = 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:

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...
You should be using *filepath.Join*

should string concatenation have spaces around it or not? :) what are the
rules that govern such formatting?



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 | 3 of 5 | next ›
Discussion Overview
groupgolang-nuts @
postedMay 18, '16 at 4:36a
activeMay 19, '16 at 2:33a



site design / logo © 2021 Grokbase