Browse Source

fix(nginx): use filepath.Base instead of path.Base for filename extraction #1196

Jacky 1 day ago
parent
commit
11510e4188
1 changed files with 4 additions and 4 deletions
  1. 4 4
      internal/nginx/type.go

+ 4 - 4
internal/nginx/type.go

@@ -1,9 +1,10 @@
 package nginx
 package nginx
 
 
 import (
 import (
-	"github.com/tufanbarisyildirim/gonginx/config"
-	"path"
+	"path/filepath"
 	"strings"
 	"strings"
+
+	"github.com/tufanbarisyildirim/gonginx/config"
 )
 )
 
 
 type NgxConfig struct {
 type NgxConfig struct {
@@ -45,7 +46,6 @@ func (d *NgxDirective) Orig() string {
 
 
 func (d *NgxDirective) TrimParams() {
 func (d *NgxDirective) TrimParams() {
 	d.Params = strings.TrimRight(strings.TrimSpace(d.Params), ";")
 	d.Params = strings.TrimRight(strings.TrimSpace(d.Params), ";")
-	return
 }
 }
 
 
 func NewNgxServer() *NgxServer {
 func NewNgxServer() *NgxServer {
@@ -59,6 +59,6 @@ func NewNgxConfig(filename string) *NgxConfig {
 	return &NgxConfig{
 	return &NgxConfig{
 		FileName:  filename,
 		FileName:  filename,
 		Upstreams: make([]*NgxUpstream, 0),
 		Upstreams: make([]*NgxUpstream, 0),
-		Name:      path.Base(filename),
+		Name:      filepath.Base(filename),
 	}
 	}
 }
 }