mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
MAINT: Enforcing formatted code (#1544)
* Enforcing formatted code Signed-off-by: Jan-Philipp Benecke <jan-philipp@bnck.me> * Show lines Signed-off-by: Jan-Philipp Benecke <jan-philipp@bnck.me> * Run check after deps are installed Signed-off-by: Jan-Philipp Benecke <jan-philipp@bnck.me>
This commit is contained in:
committed by
GitHub
parent
766f37f60d
commit
ba2c7f9c0e
@ -27,6 +27,10 @@ jobs:
|
||||
keys:
|
||||
- linux-go-{{ checksum "go.sum" }}-<< pipeline.parameters.cache-key >>
|
||||
|
||||
- run:
|
||||
name: Enforce Go Formatted Code
|
||||
command: "[ `go fmt ./... 2>&1 | wc -l` -eq 0 ]"
|
||||
|
||||
- run:
|
||||
name: Install goreleaser
|
||||
command: go install github.com/goreleaser/goreleaser@latest
|
||||
|
@ -334,8 +334,8 @@ func TestCheckDuplicates_dup_ns(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUniq(t *testing.T) {
|
||||
a := []uint32 {1, 2, 2, 3, 4, 5, 5, 6}
|
||||
expected := []uint32 {1, 2, 3, 4, 5, 6}
|
||||
a := []uint32{1, 2, 2, 3, 4, 5, 5, 6}
|
||||
expected := []uint32{1, 2, 3, 4, 5, 6}
|
||||
|
||||
r := uniq(a)
|
||||
if !reflect.DeepEqual(r, expected) {
|
||||
|
@ -88,7 +88,7 @@ func (api *autoDnsProvider) getZone(domain string) (*Zone, error) {
|
||||
}
|
||||
|
||||
// if resolving of a systemNameServer succeeds the system contains this zone
|
||||
var responseData, _ = api.request("GET", "zone/" + domain + "/" + systemNameServer.Name, nil)
|
||||
var responseData, _ = api.request("GET", "zone/"+domain+"/"+systemNameServer.Name, nil)
|
||||
var responseObject JSONResponseDataZone
|
||||
// make sure that the response is valid, the zone is in AutoDNS but we're not sure the returned data meets our expectation
|
||||
unmErr := json.Unmarshal(responseData, &responseObject)
|
||||
@ -128,7 +128,7 @@ func (api *autoDnsProvider) updateZone(domain string, resourceRecords []*Resourc
|
||||
|
||||
zone.NameServers = append(zone.NameServers, nameServers...)
|
||||
|
||||
var _, putErr = api.request("PUT", "zone/" + domain + "/" + systemNameServer.Name, zone)
|
||||
var _, putErr = api.request("PUT", "zone/"+domain+"/"+systemNameServer.Name, zone)
|
||||
|
||||
if putErr != nil {
|
||||
return putErr
|
||||
|
@ -212,7 +212,7 @@ func (api *autoDnsProvider) GetZoneRecords(domain string) (models.Records, error
|
||||
nameServerRecord.SetLabel("", domain)
|
||||
|
||||
// make sure the value for this NS record is suffixed with a dot at the end
|
||||
_ = nameServerRecord.PopulateFromString("NS", strings.TrimSuffix(nameServer.Name, ".") + ".", domain)
|
||||
_ = nameServerRecord.PopulateFromString("NS", strings.TrimSuffix(nameServer.Name, ".")+".", domain)
|
||||
|
||||
existingRecords = append(existingRecords, nameServerRecord)
|
||||
}
|
||||
|
@ -39,10 +39,9 @@ type MainAddressRecord struct {
|
||||
}
|
||||
|
||||
type Zone struct {
|
||||
|
||||
Origin string `json:"origin"`
|
||||
|
||||
Soa * bind.SoaDefaults `json:"soa,omitempty"`
|
||||
Soa *bind.SoaDefaults `json:"soa,omitempty"`
|
||||
|
||||
// List of name servers
|
||||
NameServers []*models.Nameserver `json:"nameServers,omitempty"`
|
||||
|
@ -113,7 +113,7 @@ func (n *nsone) GetZoneDNSSEC(domain string) (bool, error) {
|
||||
}
|
||||
|
||||
// getDomainCorrectionsDNSSEC creates DNSSEC zone corrections based on current state and preference
|
||||
func (n *nsone) getDomainCorrectionsDNSSEC(domain, toggleDNSSEC string) (*models.Correction) {
|
||||
func (n *nsone) getDomainCorrectionsDNSSEC(domain, toggleDNSSEC string) *models.Correction {
|
||||
|
||||
// get dnssec status from NS1 for domain
|
||||
// if errors are returned, we bail out without any DNSSEC corrections
|
||||
|
Reference in New Issue
Block a user