* Update gocql version to v1.16.1 1. Update gocql to v1.16.1 2. Update golang to 1.25, since new gocql version requres it * Update golangci to 2.5.0 It is needed since 1.64.8 does not support golang 1.25. 1. Update golangci to 2.5.0 2. Migrate from golangci config v1 to v2 3. Integrate fieldaligment to golangci 4. Drop fieldaligment from Makefile 5. Address complaints
37 lines
604 B
Go
37 lines
604 B
Go
// Copyright (C) 2017 ScyllaDB
|
|
// Use of this source code is governed by a ALv2-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package migrate
|
|
|
|
import (
|
|
"crypto/md5"
|
|
"encoding/hex"
|
|
"io"
|
|
"io/fs"
|
|
)
|
|
|
|
var encode = hex.EncodeToString
|
|
|
|
func checksum(b []byte) string {
|
|
v := md5.Sum(b)
|
|
return encode(v[:])
|
|
}
|
|
|
|
func fileChecksum(f fs.FS, path string) (string, error) {
|
|
file, err := f.Open(path)
|
|
if err != nil {
|
|
return "", nil
|
|
}
|
|
defer func() {
|
|
_ = file.Close()
|
|
}()
|
|
|
|
h := md5.New()
|
|
if _, err := io.Copy(h, file); err != nil {
|
|
return "", err
|
|
}
|
|
v := h.Sum(nil)
|
|
return encode(v), nil
|
|
}
|