go-pg efficient multi table/row insert
It doesn't seem that the pq library has a query builder or a specific type. So building a query in an idiomatic and readable way should be done as you would do for a normal string, and that is using the text/template package. This will allow you to get rid of many code smells:


the line containing your query is long and not easily readable, maybe skip more lines
you can write the skeleton to your query once, instead of using successive appends — this is also more efficient if you have many services
the call to strings.TrimSuffix can be avoided using a simple condition in your template
you can replace (select company.id from company) directly by its value, that you previously computed in your Go code
and you can get rid of the []interface{} variable that you pass to Prepare &amp; Exec, just do all the substitution logic in the go code.


Various unrelated things:


Don't write var int i = 3, write simply i := 3.
I'm not sure why Company and Service have to be exported, since you seem to only use them to build a query.
When doing successive += operations on a string, consider using a buffer instead, see this question. (But here, it's moot, since using a template is more idiomatic.)