mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-11 03:11:50 +00:00
Enable gosimple and ineffasign linters
This commit is contained in:
@@ -165,7 +165,7 @@ func (storage *PublishedStorage) putFile(path string, source io.ReadSeeker) erro
|
||||
return err
|
||||
}
|
||||
|
||||
if storage.plusWorkaround && strings.Index(path, "+") != -1 {
|
||||
if storage.plusWorkaround && strings.Contains(path, "+") {
|
||||
_, err = source.Seek(0, 0)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -187,7 +187,7 @@ func (storage *PublishedStorage) Remove(path string) error {
|
||||
return errors.Wrap(err, fmt.Sprintf("error deleting %s from %s", path, storage))
|
||||
}
|
||||
|
||||
if storage.plusWorkaround && strings.Index(path, "+") != -1 {
|
||||
if storage.plusWorkaround && strings.Contains(path, "+") {
|
||||
// try to remove workaround version, but don't care about result
|
||||
_ = storage.Remove(strings.Replace(path, "+", " ", -1))
|
||||
}
|
||||
@@ -332,7 +332,7 @@ func (storage *PublishedStorage) internalFilelist(prefix string, hidePlusWorkaro
|
||||
|
||||
err = storage.s3.ListObjectsPages(params, func(contents *s3.ListObjectsOutput, lastPage bool) bool {
|
||||
for _, key := range contents.Contents {
|
||||
if storage.plusWorkaround && hidePlusWorkaround && strings.Index(*key.Key, " ") != -1 {
|
||||
if storage.plusWorkaround && hidePlusWorkaround && strings.Contains(*key.Key, " ") {
|
||||
// if we use plusWorkaround, we want to hide those duplicates
|
||||
/// from listing
|
||||
continue
|
||||
|
||||
@@ -646,7 +646,7 @@ func (objr objectResource) put(a *action) interface{} {
|
||||
fatalError(400, "TODO", "read error")
|
||||
}
|
||||
gotHash := sum.Sum(nil)
|
||||
if expectHash != nil && bytes.Compare(gotHash, expectHash) != 0 {
|
||||
if expectHash != nil && !bytes.Equal(gotHash, expectHash) {
|
||||
fatalError(400, "BadDigest", "The Content-MD5 you specified did not match what we received")
|
||||
}
|
||||
if a.req.ContentLength >= 0 && int64(len(data)) != a.req.ContentLength {
|
||||
|
||||
Reference in New Issue
Block a user