“运行时错误:无效的内存地址或空指针取消引用”创建表

I'm getting my feet wet with Go 1.11 and postgres.

package db

import (
    "database/sql"
    _ "github.com/lib/pq" //database connector
    g "app/globalvariables"
)

func CreateTable(tid int) {
s := "CREATE TABLE someschema.sometable" + string(tid) + "(id serial PRIMARY KEY,...);"
    db, _ := sql.Open("postgres", "user="+g.DB_USER+" dbname="+g.DB_NAME+" sslmode=disable")
    defer db.Close()
    q, _ := db.Prepare(s)
    q.Exec()
}

When testing the function I get:

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x51d46a]

What can it be?

I was wronly converting an integer to string with "string". I must use strconv.Iota.