Fix godoc style comments (#356)

This commit is contained in:
Christian Muehlhaeuser
2020-11-13 00:14:59 +01:00
committed by GitHub
parent 8f921fbfde
commit 2e1f8d29b5
59 changed files with 147 additions and 147 deletions

View File

@@ -10,7 +10,7 @@ import (
log "github.com/sirupsen/logrus"
)
//GenerateClientIDFromRequest generates a client id from the provided request
// GenerateClientIDFromRequest generates a client id from the provided request.
func GenerateClientIDFromRequest(req *http.Request) string {
ipAddress := GetIPAddressFromRequest(req)
ipAddressComponents := strings.Split(ipAddress, ":")
@@ -23,7 +23,7 @@ func GenerateClientIDFromRequest(req *http.Request) string {
return hex.EncodeToString(hasher.Sum(nil))
}
// GetIPAddressFromRequest returns the IP address from a http request
// GetIPAddressFromRequest returns the IP address from a http request.
func GetIPAddressFromRequest(req *http.Request) string {
ipAddressString := req.RemoteAddr
xForwardedFor := req.Header.Get("X-FORWARDED-FOR")

View File

@@ -5,13 +5,13 @@ import (
"time"
)
// The "start" timestamp of a timing event
// The "start" timestamp of a timing event.
var _pointsInTime = make(map[string]time.Time)
// A collection of timestamp durations for returning the average of
// A collection of timestamp durations for returning the average of.
var _durationStorage = make(map[string][]float64)
// StartPerformanceMonitor will keep track of the start time of this event
// StartPerformanceMonitor will keep track of the start time of this event.
func StartPerformanceMonitor(key string) {
if len(_durationStorage[key]) > 30 {
_durationStorage[key] = removeHighAndLow(_durationStorage[key])
@@ -19,7 +19,7 @@ func StartPerformanceMonitor(key string) {
_pointsInTime[key] = time.Now()
}
// GetAveragePerformance will return the average durations for the event
// GetAveragePerformance will return the average durations for the event.
func GetAveragePerformance(key string) float64 {
timestamp := _pointsInTime[key]
if timestamp.IsZero() {

View File

@@ -15,12 +15,12 @@ import (
"mvdan.cc/xurls"
)
//GetTemporaryPipePath gets the temporary path for the streampipe.flv file
// GetTemporaryPipePath gets the temporary path for the streampipe.flv file.
func GetTemporaryPipePath() string {
return filepath.Join(os.TempDir(), "streampipe.flv")
}
//DoesFileExists checks if the file exists
// DoesFileExists checks if the file exists.
func DoesFileExists(name string) bool {
if _, err := os.Stat(name); err != nil {
if os.IsNotExist(err) {
@@ -31,7 +31,7 @@ func DoesFileExists(name string) bool {
return true
}
//GetRelativePathFromAbsolutePath gets the relative path from the provided absolute path
// GetRelativePathFromAbsolutePath gets the relative path from the provided absolute path.
func GetRelativePathFromAbsolutePath(path string) string {
pathComponents := strings.Split(path, "/")
variant := pathComponents[len(pathComponents)-2]
@@ -47,7 +47,7 @@ func GetIndexFromFilePath(path string) string {
return variant
}
//Copy copies the file to destination
// Copy copies the file to destination.
func Copy(source, destination string) error {
input, err := ioutil.ReadFile(source)
if err != nil {
@@ -57,12 +57,12 @@ func Copy(source, destination string) error {
return ioutil.WriteFile(destination, input, 0644)
}
//Move moves the file to destination
// Move moves the file to destination.
func Move(source, destination string) error {
return os.Rename(source, destination)
}
// IsUserAgentABot returns if a web client user-agent is seen as a bot
// IsUserAgentABot returns if a web client user-agent is seen as a bot.
func IsUserAgentABot(userAgent string) bool {
if userAgent == "" {
return false
@@ -111,7 +111,7 @@ func RenderSimpleMarkdown(raw string) string {
return buf.String()
}
// GetCacheDurationSecondsForPath will return the number of seconds to cache an item
// GetCacheDurationSecondsForPath will return the number of seconds to cache an item.
func GetCacheDurationSecondsForPath(filePath string) int {
if path.Base(filePath) == "thumbnail.jpg" {
// Thumbnails re-generate during live