github.com/netdata/go.d.plugin@v0.58.1/agent/executable/name.go (about)

     1  // SPDX-License-Identifier: GPL-3.0-or-later
     2  
     3  package executable
     4  
     5  import (
     6  	"os"
     7  	"path/filepath"
     8  	"strings"
     9  )
    10  
    11  var Name string
    12  
    13  func init() {
    14  	s, err := os.Executable()
    15  	if err != nil || s == "" || strings.HasSuffix(s, ".test") {
    16  		Name = "go.d"
    17  		return
    18  	}
    19  
    20  	_, Name = filepath.Split(s)
    21  	Name = strings.TrimSuffix(Name, ".plugin")
    22  }