Var type not taken in during compiling

Hello folks,
I have Go file resource_bigip_sys_iapp.go in which I have defined var as type Iapp as shown below

package bigip

import (
“fmt”
github.com/f5devcentral/go-bigip
github.com/hashicorp/terraform/helper/schema
“log”
“encoding/json”
)
var iappstruct []Iapp
func resourceBigipSysIappCreate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*bigip.BigIP)
name := d.Get(“name”).(string)
log.Println("[INFO] Creating Iapp " + name)
jsonblob := []byte(d.Get(“jsonfile”).(string))
err := json.Unmarshal(jsonblob, &iappstruct)
if err != nil {
fmt.Println(“error”, err)
}

I am getting this error while compiling

SJC-ML-SHITOLE:terraform-provider-bigip shitole$ go build

github.com/f5devcentral/terraform-provider-bigip/bigip

bigip/resource_bigip_sys_iapp.go:221:18: undefined: Iapp

Iapp struct is define in the file application.go as shown below

package bigip

import (
“encoding/json”
//“log”
)

type Iapps struct {
Iapps []Iapp json:"items"
}

type Iapp struct {
Name string
Partition string
Description string
Devicegroup string
ExecuteAction string
InheritedDevicegroup string
StrictUpdates string
Template string
TemplateModified string
TemplatePrerequisiteErrors string
TrafficGroup string
InheritedTrafficGroup string
Lists []Listsrecord
Metadata []Metadatarecord
Tables []Tablesrecord
Variables []Variablesrecord
Jsonfile string
}

1 Like

You may need to be more specific in what you are asking Go to build. Try running the command:
go build *.go
Or alternatively, you may want:
go run *.go

1 Like

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