Expanded linting + fix warnings (#1396)

* Expand the linters and types of warnings to improve consistency and safety

* Fail lint workflow if there are errors

* golint has been replaced by revive

* Hand-pick some of the default exclude list

* Ignore error when trying to delete preview gif

* Ignore linter warning opening playlist path

* Rename user field Id -> ID

* A bunch of renames to address linter warnings

* Rename ChatClient -> Client per linter suggestion best practice

* Rename ChatServer -> Server per linter suggestion best practice

* More linter warning fixes

* Add missing comments to all exported functions and properties
This commit is contained in:
Gabe Kangas
2021-09-12 00:18:15 -07:00
committed by GitHub
parent 70e9f4945f
commit c6c6f0233d
57 changed files with 331 additions and 186 deletions

View File

@@ -72,6 +72,7 @@ func SetStreamTitle(w http.ResponseWriter, r *http.Request) {
controllers.WriteSimpleResponse(w, true, "changed")
}
// ExternalSetStreamTitle will change the stream title on behalf of an external integration API request.
func ExternalSetStreamTitle(integration user.ExternalAPIUser, w http.ResponseWriter, r *http.Request) {
SetStreamTitle(w, r)
}
@@ -298,11 +299,12 @@ func SetWebServerPort(w http.ResponseWriter, r *http.Request) {
if err := data.SetHTTPPortNumber(port); err != nil {
controllers.WriteSimpleResponse(w, false, err.Error())
return
} else {
controllers.WriteSimpleResponse(w, true, "HTTP port set")
return
}
controllers.WriteSimpleResponse(w, true, "HTTP port set")
return
}
controllers.WriteSimpleResponse(w, false, "Invalid type or value, port must be a number")
}
@@ -322,14 +324,14 @@ func SetWebServerIP(w http.ResponseWriter, r *http.Request) {
if err := data.SetHTTPListenAddress(ip.String()); err != nil {
controllers.WriteSimpleResponse(w, false, err.Error())
return
} else {
controllers.WriteSimpleResponse(w, true, "HTTP listen address set")
return
}
} else {
controllers.WriteSimpleResponse(w, false, "Invalid IP address")
controllers.WriteSimpleResponse(w, true, "HTTP listen address set")
return
}
controllers.WriteSimpleResponse(w, false, "Invalid IP address")
return
}
controllers.WriteSimpleResponse(w, false, "Invalid type or value, IP address must be a string")
}
@@ -427,7 +429,7 @@ func SetS3Configuration(w http.ResponseWriter, r *http.Request) {
}
if newS3Config.Value.Enabled {
if newS3Config.Value.Endpoint == "" || !utils.IsValidUrl((newS3Config.Value.Endpoint)) {
if newS3Config.Value.Endpoint == "" || !utils.IsValidURL((newS3Config.Value.Endpoint)) {
controllers.WriteSimpleResponse(w, false, "s3 support requires an endpoint")
return
}