fix build scripts, port go-mysql-org/go-mysql#349 to remove cgo dep

This commit is contained in:
dm-2 2022-01-26 15:04:27 +00:00
parent 8e5bd715c4
commit fd375119a3
5 changed files with 8 additions and 8 deletions

View File

@ -73,4 +73,7 @@ main() {
(cd $buildpath && shasum -a256 gh-ost* 2>/dev/null)
}
. script/bootstrap
cd .gopath/src/github.com/github/gh-ost
main "$@"

View File

@ -10,7 +10,6 @@ set -e
# Since we want to be able to build this outside of GOPATH, we set it
# up so it points back to us and go is none the wiser
set -x
rm -rf .gopath
mkdir -p .gopath/src/github.com/github
ln -s "$PWD" .gopath/src/github.com/github/gh-ost

View File

@ -1,7 +1,7 @@
#!/bin/bash
PREFERRED_GO_VERSION=go1.16.4
SUPPORTED_GO_VERSIONS='go1.1[56]'
SUPPORTED_GO_VERSIONS='go1.1[567]'
GO_PKG_DARWIN=${PREFERRED_GO_VERSION}.darwin-amd64.pkg
GO_PKG_DARWIN_SHA=0f215de06019a054a3da46a0722989986c956d719c7a0a8fc38a5f3c216d6f6b
@ -35,7 +35,7 @@ if [ -z "$(which go)" ] || [ -z "$(go version | grep "$SUPPORTED_GO_VERSIONS")"
curl -L -O https://dl.google.com/go/$GO_PKG_DARWIN
shasum -a256 $GO_PKG_DARWIN | grep $GO_PKG_DARWIN_SHA
xar -xf $GO_PKG_DARWIN
cpio -i < com.googlecode.go.pkg/Payload
cpio -i < org.golang.go.pkg/Payload
else
curl -L -O https://dl.google.com/go/$GO_PKG_LINUX
shasum -a256 $GO_PKG_LINUX | grep $GO_PKG_LINUX_SHA

View File

@ -1,6 +1,5 @@
package client
import "C"
import (
"encoding/binary"

View File

@ -1,6 +1,5 @@
package packet
import "C"
import (
"bytes"
"io"
@ -127,7 +126,7 @@ func (c *Conn) WritePacket(data []byte) error {
func (c *Conn) WriteClearAuthPacket(password string) error {
// Calculate the packet length and add a tailing 0
pktLen := len(password) + 1
data := make([]byte, 4 + pktLen)
data := make([]byte, 4+pktLen)
// Add the clear password [null terminated string]
copy(data[4:], password)
@ -140,7 +139,7 @@ func (c *Conn) WriteClearAuthPacket(password string) error {
// http://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::AuthSwitchResponse
func (c *Conn) WritePublicKeyAuthPacket(password string, cipher []byte) error {
// request public key
data := make([]byte, 4 + 1)
data := make([]byte, 4+1)
data[4] = 2 // cachingSha2PasswordRequestPublicKey
c.WritePacket(data)
@ -163,7 +162,7 @@ func (c *Conn) WritePublicKeyAuthPacket(password string, cipher []byte) error {
}
sha1v := sha1.New()
enc, _ := rsa.EncryptOAEP(sha1v, rand.Reader, pub.(*rsa.PublicKey), plain, nil)
data = make([]byte, 4 + len(enc))
data = make([]byte, 4+len(enc))
copy(data[4:], enc)
return c.WritePacket(data)
}