Here is my code. I extract my struct OperatInfo to the struct.go and wanna to use this struct in the main package which in worker.go.
struct.go
package batch
type OperatInfo struct {
eventId string
hallId string
userId string
operating string
operatingID string
ip string
}
worker.go
package main
import (
"time"
"fmt"
"strconv"
"./kernel/api"
"./kernel/db"
"./batch/basic"
"./batch/struct"
)
var operatInfo batch.OperatInfo
func BatchDeposit(eventId string, userId string, hallId string, operating string, operatingID string, ip string) {
// I get an error here
operatInfo.eventId = eventId
operatInfo.hallId = hallId
operatInfo.userId = userId
operatInfo.operating = operating
operatInfo.operatingID = operatingID
operatInfo.ip = ip
}
I just can't set operatInfo fields.
Any suggestions or tips will helps. Thanks.