Skip to content

Commit

Permalink
Merge pull request #69 from blinklabs-io/chore/golines
Browse files Browse the repository at this point in the history
chore: add golines to make target and run it
  • Loading branch information
wolf31o2 authored Nov 8, 2023
2 parents e27aa4a + 159541b commit 9a035c5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ GOMODULE=$(shell grep ^module $(ROOT_DIR)/go.mod | awk '{ print $$2 }')
# Set version strings based on git tag and current ref
GO_LDFLAGS=-ldflags "-s -w"

.PHONY: build mod-tidy clean test
.PHONY: build mod-tidy clean format golines test

# Alias for building program binary
build: $(BINARIES)
Expand All @@ -25,6 +25,12 @@ mod-tidy:
clean:
rm -f $(BINARIES)

format:
go fmt ./...

golines:
golines -w --ignore-generated --chain-split-dots --max-len=80 --reformat-tags .

test: mod-tidy
go test -v ./...

Expand Down
9 changes: 7 additions & 2 deletions internal/dns/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,13 @@ func handleQuery(w dns.ResponseWriter, r *dns.Msg) {
if address.To4() != nil {
// IPv4
a := &dns.A{
Hdr: dns.RR_Header{Name: k, Rrtype: dns.TypeA, Class: dns.ClassINET, Ttl: 999},
A: address,
Hdr: dns.RR_Header{
Name: k,
Rrtype: dns.TypeA,
Class: dns.ClassINET,
Ttl: 999,
},
A: address,
}
m.Answer = append(m.Answer, a)
} else {
Expand Down
9 changes: 7 additions & 2 deletions internal/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ func (s *State) LookupDomain(domainName string) (map[string]string, error) {
}

// LookupNameserverRecord searches the domain nameserver entries for one matching the requested record
func (s *State) LookupNameserverRecord(recordName string) (map[string]string, error) {
func (s *State) LookupNameserverRecord(
recordName string,
) (map[string]string, error) {
ret := map[string]string{}
err := s.db.View(func(txn *badger.Txn) error {
opts := badger.DefaultIteratorOptions
Expand All @@ -139,7 +141,10 @@ func (s *State) LookupNameserverRecord(recordName string) (map[string]string, er
for it.Rewind(); it.Valid(); it.Next() {
item := it.Item()
k := item.Key()
if strings.HasSuffix(string(k), fmt.Sprintf("_nameserver_%s", recordName)) {
if strings.HasSuffix(
string(k),
fmt.Sprintf("_nameserver_%s", recordName),
) {
err := item.Value(func(v []byte) error {
ret[recordName] = string(v)
return nil
Expand Down

0 comments on commit 9a035c5

Please sign in to comment.