fixed struct alignment && refactor linter (#369)
All checks were successful
test / test (push) Successful in 42s
All checks were successful
test / test (push) Successful in 42s
## Pull Request template Please, go through these steps before clicking submit on this PR. 1. Give a descriptive title to your PR. 2. Provide a description of your changes. 3. Make sure you have some relevant tests. 4. Put `closes #XXXX` in your comment to auto-close the issue that your PR fixes (if applicable). **PLEASE REMOVE THIS TEMPLATE BEFORE SUBMITTING** Reviewed-on: #369 Co-authored-by: Evstigneev Denis <danteevstigneev@yandex.ru> Co-committed-by: Evstigneev Denis <danteevstigneev@yandex.ru>
This commit is contained in:
@@ -10,11 +10,18 @@ import (
|
||||
type DigitalOceanMetadata struct {
|
||||
Metadata struct {
|
||||
V1 struct {
|
||||
DropletID int64 `json:"droplet_id"`
|
||||
Hostname string `json:"hostname"`
|
||||
VendorData string `json:"vendor_data"`
|
||||
Features map[string]interface{} `json:"features"`
|
||||
|
||||
Hostname string `json:"hostname"`
|
||||
VendorData string `json:"vendor_data"`
|
||||
Region string `json:"region"`
|
||||
|
||||
PublicKeys []string `json:"public_keys"`
|
||||
Region string `json:"region"`
|
||||
|
||||
DNS struct {
|
||||
Nameservers []string `json:"nameservers"`
|
||||
} `json:"dns"`
|
||||
|
||||
Interfaces struct {
|
||||
Private []struct {
|
||||
IPv4 struct {
|
||||
@@ -31,24 +38,23 @@ type DigitalOceanMetadata struct {
|
||||
Netmask string `json:"netmask"`
|
||||
Gateway string `json:"gateway"`
|
||||
} `json:"ipv4"`
|
||||
IPv6 struct {
|
||||
Address string `json:"ip_address"`
|
||||
CIDR int `json:"cidr"`
|
||||
Gateway string `json:"gateway"`
|
||||
} `json:"ipv6"`
|
||||
Mac string `json:"mac"`
|
||||
Type string `json:"type"`
|
||||
IPv6 struct {
|
||||
Address string `json:"ip_address"`
|
||||
Gateway string `json:"gateway"`
|
||||
CIDR int `json:"cidr"`
|
||||
} `json:"ipv6"`
|
||||
} `json:"public"`
|
||||
} `json:"interfaces"`
|
||||
|
||||
DropletID int64 `json:"droplet_id"`
|
||||
|
||||
FloatingIP struct {
|
||||
IPv4 struct {
|
||||
Active bool `json:"active"`
|
||||
} `json:"ipv4"`
|
||||
} `json:"floating_ip"`
|
||||
DNS struct {
|
||||
Nameservers []string `json:"nameservers"`
|
||||
} `json:"dns"`
|
||||
Features map[string]interface{} `json:"features"`
|
||||
} `json:"v1"`
|
||||
} `json:"metadata"`
|
||||
}
|
||||
|
@@ -2,29 +2,29 @@ package structfs
|
||||
|
||||
type EC2Metadata struct {
|
||||
Latest struct {
|
||||
Userdata string `json:"user-data"`
|
||||
Metadata struct {
|
||||
AMIID int `json:"ami-id"`
|
||||
AMILaunchIndex int `json:"ami-launch-index"`
|
||||
AMIManifestPath string `json:"ami-manifest-path"`
|
||||
AncestorAMIIDs []int `json:"ancestor-ami-ids"`
|
||||
BlockDeviceMapping []string `json:"block-device-mapping"`
|
||||
InstanceID int `json:"instance-id"`
|
||||
InstanceType string `json:"instance-type"`
|
||||
LocalHostname string `json:"local-hostname"`
|
||||
LocalIPv4 string `json:"local-ipv4"`
|
||||
KernelID int `json:"kernel-id"`
|
||||
Placement string `json:"placement"`
|
||||
AvailabilityZone string `json:"availability-zone"`
|
||||
ProductCodes string `json:"product-codes"`
|
||||
PublicHostname string `json:"public-hostname"`
|
||||
PublicIPv4 string `json:"public-ipv4"`
|
||||
PublicKeys []struct {
|
||||
AMIManifestPath string `json:"ami-manifest-path"`
|
||||
InstanceType string `json:"instance-type"`
|
||||
LocalHostname string `json:"local-hostname"`
|
||||
LocalIPv4 string `json:"local-ipv4"`
|
||||
Placement string `json:"placement"`
|
||||
AvailabilityZone string `json:"availability-zone"`
|
||||
ProductCodes string `json:"product-codes"`
|
||||
PublicHostname string `json:"public-hostname"`
|
||||
PublicIPv4 string `json:"public-ipv4"`
|
||||
PublicKeys []struct {
|
||||
Key []string `json:"-"`
|
||||
} `json:"public-keys"`
|
||||
RamdiskID int `json:"ramdisk-id"`
|
||||
ReservationID int `json:"reservation-id"`
|
||||
SecurityGroups []string `json:"security-groups"`
|
||||
AncestorAMIIDs []int `json:"ancestor-ami-ids"`
|
||||
BlockDeviceMapping []string `json:"block-device-mapping"`
|
||||
SecurityGroups []string `json:"security-groups"`
|
||||
RamdiskID int `json:"ramdisk-id"`
|
||||
ReservationID int `json:"reservation-id"`
|
||||
AMIID int `json:"ami-id"`
|
||||
AMILaunchIndex int `json:"ami-launch-index"`
|
||||
KernelID int `json:"kernel-id"`
|
||||
InstanceID int `json:"instance-id"`
|
||||
} `json:"meta-data"`
|
||||
Userdata string `json:"user-data"`
|
||||
} `json:"latest"`
|
||||
}
|
||||
|
@@ -35,22 +35,22 @@ func (fs *fs) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
type fs struct {
|
||||
modtime time.Time
|
||||
iface interface{}
|
||||
tag string
|
||||
modtime time.Time
|
||||
}
|
||||
|
||||
type file struct {
|
||||
name string
|
||||
offset int64
|
||||
data []byte
|
||||
modtime time.Time
|
||||
name string
|
||||
data []byte
|
||||
offset int64
|
||||
}
|
||||
|
||||
type fileInfo struct {
|
||||
modtime time.Time
|
||||
name string
|
||||
size int64
|
||||
modtime time.Time
|
||||
}
|
||||
|
||||
func (fi *fileInfo) Sys() interface{} {
|
||||
@@ -105,7 +105,7 @@ func (f *file) Read(b []byte) (int, error) {
|
||||
return n, err
|
||||
}
|
||||
|
||||
func (f *file) Readdir(count int) ([]os.FileInfo, error) {
|
||||
func (f *file) Readdir(_ int) ([]os.FileInfo, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
@@ -93,7 +93,7 @@ func TestAll(t *testing.T) {
|
||||
in string
|
||||
out string
|
||||
}{
|
||||
{"http://127.0.0.1:8080/metadata/v1/", "droplet_id\nhostname\nvendor_data\npublic_keys\nregion\ninterfaces\nfloating_ip\ndns\nfeatures"},
|
||||
{"http://127.0.0.1:8080/metadata/v1/", "features\nhostname\nvendor_data\nregion\npublic_keys\ndns\ninterfaces\ndroplet_id\nfloating_ip"},
|
||||
{"http://127.0.0.1:8080/metadata/v1/droplet_id", "2756294"},
|
||||
{"http://127.0.0.1:8080/metadata/v1/dns/", "nameservers"},
|
||||
{"http://127.0.0.1:8080/metadata/v1/dns/nameservers", "2001:4860:4860::8844\n2001:4860:4860::8888\n8.8.8.8"},
|
||||
|
Reference in New Issue
Block a user