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:
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/owncast/owncast/utils"
|
||||
)
|
||||
|
||||
// LocalStorage represents an instance of the local storage provider for HLS video.
|
||||
type LocalStorage struct {
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
// then keep a reference to it here.
|
||||
var _queuedPlaylistUpdates = make(map[string]string)
|
||||
|
||||
// S3Storage is the s3 implementation of the ChunkStorageProvider.
|
||||
// S3Storage is the s3 implementation of a storage provider.
|
||||
type S3Storage struct {
|
||||
sess *session.Session
|
||||
host string
|
||||
@@ -124,7 +124,7 @@ func (s *S3Storage) MasterPlaylistWritten(localFilePath string) {
|
||||
|
||||
// Save saves the file to the s3 bucket.
|
||||
func (s *S3Storage) Save(filePath string, retryCount int) (string, error) {
|
||||
file, err := os.Open(filePath)
|
||||
file, err := os.Open(filePath) // nolint
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -153,10 +153,10 @@ func (s *S3Storage) Save(filePath string, retryCount int) (string, error) {
|
||||
if retryCount < 4 {
|
||||
log.Traceln("Retrying...")
|
||||
return s.Save(filePath, retryCount+1)
|
||||
} else {
|
||||
log.Warnln("Giving up on", filePath, err)
|
||||
return "", fmt.Errorf("Giving up on %s", filePath)
|
||||
}
|
||||
|
||||
log.Warnln("Giving up on", filePath, err)
|
||||
return "", fmt.Errorf("Giving up on %s", filePath)
|
||||
}
|
||||
|
||||
return response.Location, nil
|
||||
@@ -185,7 +185,7 @@ func (s *S3Storage) connectAWS() *session.Session {
|
||||
|
||||
// rewriteRemotePlaylist will take a local playlist and rewrite it to have absolute URLs to remote locations.
|
||||
func (s *S3Storage) rewriteRemotePlaylist(filePath string) error {
|
||||
f, err := os.Open(filePath)
|
||||
f, err := os.Open(filePath) // nolint
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user