mirror of
https://github.com/openziti/zrok.git
synced 2026-08-24 02:34:20 -05:00
cleanup of a number of 'go vet' issues... literals, unbuffered channels in signal handling, canary context
This commit is contained in:
@@ -250,7 +250,7 @@ func (cmd *accessPrivateCommand) accessLocal(args []string, root env_core.Root)
|
||||
}()
|
||||
}
|
||||
|
||||
c := make(chan os.Signal)
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGTERM, syscall.SIGKILL, syscall.SIGQUIT)
|
||||
go func() {
|
||||
<-c
|
||||
|
||||
@@ -47,7 +47,7 @@ func (cmd *bridgeCommand) run(_ *cobra.Command, args []string) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
c := make(chan os.Signal)
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
||||
go func() {
|
||||
<-c
|
||||
|
||||
@@ -170,7 +170,7 @@ func (cmd *sharePrivateCommand) shareLocal(cobraCmd *cobra.Command, args []strin
|
||||
proxy.SetCaddyLoggingWriter(mdl)
|
||||
}
|
||||
|
||||
c := make(chan os.Signal)
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
||||
go func() {
|
||||
<-c
|
||||
|
||||
@@ -171,7 +171,7 @@ func (cmd *sharePublicCommand) shareLocal(args []string, root env_core.Root) {
|
||||
proxy.SetCaddyLoggingWriter(mdl)
|
||||
}
|
||||
|
||||
c := make(chan os.Signal)
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
||||
go func() {
|
||||
<-c
|
||||
|
||||
@@ -72,6 +72,7 @@ func (cmd *testCanaryEnabler) run(_ *cobra.Command, _ []string) {
|
||||
panic(err)
|
||||
}
|
||||
snsCtx, snsCancel = context.WithCancel(context.Background())
|
||||
defer snsCancel()
|
||||
sns, err = canary.NewSnapshotStreamer(snsCtx, cfg)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
||||
@@ -163,7 +163,7 @@ func (cmd *testCanaryPrivateProxy) run(_ *cobra.Command, _ []string) {
|
||||
go looper.Run()
|
||||
}
|
||||
|
||||
c := make(chan os.Signal)
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
||||
go func() {
|
||||
<-c
|
||||
|
||||
@@ -106,6 +106,7 @@ func (cmd *testCanaryPublicProxy) run(_ *cobra.Command, _ []string) {
|
||||
panic(err)
|
||||
}
|
||||
snsCtx, snsCancel = context.WithCancel(context.Background())
|
||||
defer snsCancel()
|
||||
sns, err = canary.NewSnapshotStreamer(snsCtx, cfg)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -172,7 +173,7 @@ func (cmd *testCanaryPublicProxy) run(_ *cobra.Command, _ []string) {
|
||||
go looper.Run()
|
||||
}
|
||||
|
||||
c := make(chan os.Signal)
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
||||
go func() {
|
||||
<-c
|
||||
|
||||
@@ -14,14 +14,14 @@ import (
|
||||
const Namespace = "DAV:"
|
||||
|
||||
var (
|
||||
ResourceTypeName = xml.Name{Namespace, "resourcetype"}
|
||||
DisplayNameName = xml.Name{Namespace, "displayname"}
|
||||
GetContentLengthName = xml.Name{Namespace, "getcontentlength"}
|
||||
GetContentTypeName = xml.Name{Namespace, "getcontenttype"}
|
||||
GetLastModifiedName = xml.Name{Namespace, "getlastmodified"}
|
||||
GetETagName = xml.Name{Namespace, "getetag"}
|
||||
ResourceTypeName = xml.Name{Space: Namespace, Local: "resourcetype"}
|
||||
DisplayNameName = xml.Name{Space: Namespace, Local: "displayname"}
|
||||
GetContentLengthName = xml.Name{Space: Namespace, Local: "getcontentlength"}
|
||||
GetContentTypeName = xml.Name{Space: Namespace, Local: "getcontenttype"}
|
||||
GetLastModifiedName = xml.Name{Space: Namespace, Local: "getlastmodified"}
|
||||
GetETagName = xml.Name{Space: Namespace, Local: "getetag"}
|
||||
|
||||
CurrentUserPrincipalName = xml.Name{Namespace, "current-user-principal"}
|
||||
CurrentUserPrincipalName = xml.Name{Space: Namespace, Local: "current-user-principal"}
|
||||
)
|
||||
|
||||
type Status struct {
|
||||
@@ -332,7 +332,7 @@ func (t *ResourceType) Is(name xml.Name) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
var CollectionName = xml.Name{Namespace, "collection"}
|
||||
var CollectionName = xml.Name{Space: Namespace, Local: "collection"}
|
||||
|
||||
// https://tools.ietf.org/html/rfc4918#section-15.4
|
||||
type GetContentLength struct {
|
||||
|
||||
@@ -22,7 +22,7 @@ type RawXMLValue struct {
|
||||
|
||||
// NewRawXMLElement creates a new RawXMLValue for an element.
|
||||
func NewRawXMLElement(name xml.Name, attr []xml.Attr, children []RawXMLValue) *RawXMLValue {
|
||||
return &RawXMLValue{tok: xml.StartElement{name, attr}, children: children}
|
||||
return &RawXMLValue{tok: xml.StartElement{Name: name, Attr: attr}, children: children}
|
||||
}
|
||||
|
||||
// EncodeRawXMLElement encodes a value into a new RawXMLValue. The XML value
|
||||
@@ -171,5 +171,5 @@ func valueXMLName(v interface{}) (xml.Name, error) {
|
||||
if len(nameParts) != 2 {
|
||||
return xml.Name{}, fmt.Errorf("webdav: expected a namespace and local name in %T.XMLName's xml tag", v)
|
||||
}
|
||||
return xml.Name{nameParts[0], nameParts[1]}, nil
|
||||
return xml.Name{Space: nameParts[0], Local: nameParts[1]}, nil
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ func main() {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
c := make(chan os.Signal)
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
||||
go func() {
|
||||
<-c
|
||||
|
||||
Reference in New Issue
Block a user