Formatting code

One of the things I’m finding frustrating with Go is formatting my code. Here is another example of being forced to put everything on a single line or I get errors. Is there a way to do something like this. The reason is that some queries are freaking huge and trying to put it all on a single line would be insane.

if queryuser, err = db.Prepare("select UserID, CurrentDB, DBHost 
                                                from optUsers 
                                                where LoginHash = ?"); err != nil  {
  println(err)
  panic( "queryuser Statement failed to create" )
}

Error: supportservice.go:54:67: newline in string

Because I’ll end up with a ton of statements being built like this I’m trying to keep it as clean as possible. Is there a better way?

Use a raw string (enclosed in backticks: `, it allows breaks.

`I am
a
raw string`
1 Like

thanks

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.