Skip to content

Commit 9a035c5

Browse files
authored
Merge pull request #69 from blinklabs-io/chore/golines
chore: add golines to make target and run it
2 parents e27aa4a + 159541b commit 9a035c5

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

Makefile

+7-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ GOMODULE=$(shell grep ^module $(ROOT_DIR)/go.mod | awk '{ print $$2 }')
1313
# Set version strings based on git tag and current ref
1414
GO_LDFLAGS=-ldflags "-s -w"
1515

16-
.PHONY: build mod-tidy clean test
16+
.PHONY: build mod-tidy clean format golines test
1717

1818
# Alias for building program binary
1919
build: $(BINARIES)
@@ -25,6 +25,12 @@ mod-tidy:
2525
clean:
2626
rm -f $(BINARIES)
2727

28+
format:
29+
go fmt ./...
30+
31+
golines:
32+
golines -w --ignore-generated --chain-split-dots --max-len=80 --reformat-tags .
33+
2834
test: mod-tidy
2935
go test -v ./...
3036

internal/dns/dns.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,13 @@ func handleQuery(w dns.ResponseWriter, r *dns.Msg) {
8080
if address.To4() != nil {
8181
// IPv4
8282
a := &dns.A{
83-
Hdr: dns.RR_Header{Name: k, Rrtype: dns.TypeA, Class: dns.ClassINET, Ttl: 999},
84-
A: address,
83+
Hdr: dns.RR_Header{
84+
Name: k,
85+
Rrtype: dns.TypeA,
86+
Class: dns.ClassINET,
87+
Ttl: 999,
88+
},
89+
A: address,
8590
}
8691
m.Answer = append(m.Answer, a)
8792
} else {

internal/state/state.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ func (s *State) LookupDomain(domainName string) (map[string]string, error) {
128128
}
129129

130130
// LookupNameserverRecord searches the domain nameserver entries for one matching the requested record
131-
func (s *State) LookupNameserverRecord(recordName string) (map[string]string, error) {
131+
func (s *State) LookupNameserverRecord(
132+
recordName string,
133+
) (map[string]string, error) {
132134
ret := map[string]string{}
133135
err := s.db.View(func(txn *badger.Txn) error {
134136
opts := badger.DefaultIteratorOptions
@@ -139,7 +141,10 @@ func (s *State) LookupNameserverRecord(recordName string) (map[string]string, er
139141
for it.Rewind(); it.Valid(); it.Next() {
140142
item := it.Item()
141143
k := item.Key()
142-
if strings.HasSuffix(string(k), fmt.Sprintf("_nameserver_%s", recordName)) {
144+
if strings.HasSuffix(
145+
string(k),
146+
fmt.Sprintf("_nameserver_%s", recordName),
147+
) {
143148
err := item.Value(func(v []byte) error {
144149
ret[recordName] = string(v)
145150
return nil

0 commit comments

Comments
 (0)