Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use channel directions where possible #299

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/pkg/powerdnsutils/powerdnsutils_dnsquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func GetZoneFilePerAXFR(address, zoneid string, readtimeout time.Duration) (stri
func doZoneTransfer(zoneid string, address string, readtimeout time.Duration) (zonefile string, err error) {
var conn net.Conn

var channel chan *dns.Envelope
var channel <-chan *dns.Envelope

var d net.Dialer

Expand All @@ -42,7 +42,7 @@ func doZoneTransfer(zoneid string, address string, readtimeout time.Duration) (z
return
}

func receiveAllRecords(channel chan *dns.Envelope) ([]dns.RR, error) {
func receiveAllRecords(channel <-chan *dns.Envelope) ([]dns.RR, error) {
var answerrr []dns.RR

for envmsg := range channel {
Expand Down
14 changes: 7 additions & 7 deletions pkg/microservice/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (
"github.com/rs/zerolog/log"
)

var signalchannel chan os.Signal //nolint:gochecknoglobals
var signalChannel chan<- os.Signal //nolint:gochecknoglobals

// InitGlobalLogger set global logging settings.
func InitGlobalLogger(sigchannel chan os.Signal) {
func InitGlobalLogger(sigchannel chan<- os.Signal) {
zerolog.TimeFieldFormat = time.RFC3339Nano
zerolog.SetGlobalLevel(zerolog.InfoLevel)

signalchannel = sigchannel
signalChannel = sigchannel
}

// SetDefaultLogLevel with panic, fatal, error, warn, info, debug
Expand Down Expand Up @@ -82,13 +82,13 @@ func ErrorLog(message string) {
}

func FatalLog(message string) {
signalchannel <- syscall.SIGINT
signalChannel <- syscall.SIGINT

log.Log().Str("level", "fatal").Msg(message)
}

func PanicLog(message string) {
signalchannel <- syscall.SIGINT
signalChannel <- syscall.SIGINT

log.Panic().Msg(message)
}
Expand All @@ -110,13 +110,13 @@ func ErrorErrLog(err error) {
}

func FatalErrLog(err error) {
signalchannel <- syscall.SIGINT
signalChannel <- syscall.SIGINT

log.Log().Str("level", "fatal").Err(err).Msg("")
}

func PanicErrLog(err error) {
signalchannel <- syscall.SIGINT
signalChannel <- syscall.SIGINT

log.Panic().Err(err).Msg("")
}
2 changes: 1 addition & 1 deletion pkg/microservice/servicediscovery/servicediscovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func (sd *ServiceDiscovery) PutValue(key string, value []byte) error {
return err
}

func (sd *ServiceDiscovery) SubscribeToKey(key string, valuechan chan []byte) {
func (sd *ServiceDiscovery) SubscribeToKey(key string, valuechan chan<- []byte) {
actualIndex := uint64(0)

go func() {
Expand Down
Loading