Using modules not able to import a simple struct

i have a simple struct in a package:

// Report …
type Report struct {
SysrptID json.Number json:"sysrptID"
Description string json:"Description"
FileName string json:"FileName"
Name string json:"Name"
}

// Reports defines a slice of Report
type Reports []*Report

i have this code in a data package with
this for the module

module comanyname/reports/report-api

and reports.go it is in a folder called data

in the package main

package main

import (

"encoding/json"
"fmt"
"io/ioutil"
"log"
"os"
"companyname/reports/report-api/data"

[it never finds this]

)

// JSONdataReports a []struct representing Reports

var JSONdataReports Reports

I get undefined Reports for the var

if i copy the types to the main.go file it works great

What in the world am i missing

You have to say var JSONdataReports data.Reports because the Reports type is in the data package.

I was pulling out what was left of my hair!!!
Thanks!
that was it, such a noob

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