diff --git a/cassandra_only_test.go b/cassandra_only_test.go index ae37465dd..fd02d01b0 100644 --- a/cassandra_only_test.go +++ b/cassandra_only_test.go @@ -1,3 +1,4 @@ +//go:build (all || cassandra) && !scylla // +build all cassandra // +build !scylla diff --git a/exec_test.go b/exec_test.go index 09250a272..8ee698786 100644 --- a/exec_test.go +++ b/exec_test.go @@ -1,3 +1,4 @@ +//go:build all || integration // +build all integration package gocql diff --git a/host_source.go b/host_source.go index 8dcf371ae..8aaaa1a66 100644 --- a/host_source.go +++ b/host_source.go @@ -435,10 +435,10 @@ func (h *HostInfo) Hostname() string { } func (h *HostInfo) ConnectAddressAndPort() string { - h.mu.Lock() - defer h.mu.Unlock() - addr, _ := h.connectAddressLocked() - return net.JoinHostPort(addr.String(), strconv.Itoa(h.port)) + h.mu.Lock() + defer h.mu.Unlock() + addr, _ := h.connectAddressLocked() + return net.JoinHostPort(addr.String(), strconv.Itoa(h.port)) } func (h *HostInfo) String() string { diff --git a/integration_cassandra_only_test.go b/integration_cassandra_only_test.go index a24756208..7e6ab6a13 100644 --- a/integration_cassandra_only_test.go +++ b/integration_cassandra_only_test.go @@ -1,3 +1,4 @@ +//go:build (all || integration) && !scylla // +build all integration // +build !scylla diff --git a/internal/murmur/murmur_appengine.go b/internal/murmur/murmur_appengine.go index 63c3eb2ec..79a05e2ed 100644 --- a/internal/murmur/murmur_appengine.go +++ b/internal/murmur/murmur_appengine.go @@ -1,3 +1,4 @@ +//go:build appengine || s390x // +build appengine s390x package murmur diff --git a/internal/murmur/murmur_unsafe.go b/internal/murmur/murmur_unsafe.go index 8fc950cfb..e8b56e5cd 100644 --- a/internal/murmur/murmur_unsafe.go +++ b/internal/murmur/murmur_unsafe.go @@ -1,5 +1,5 @@ -// +build !appengine -// +build !s390x +//go:build !appengine && !s390x +// +build !appengine,!s390x package murmur diff --git a/metadata_cassandra.go b/metadata_cassandra.go index bcf8b651e..08723ddb4 100644 --- a/metadata_cassandra.go +++ b/metadata_cassandra.go @@ -1,5 +1,5 @@ -// +build cassandra -// +build !scylla +//go:build cassandra && !scylla +// +build cassandra,!scylla // Copyright (c) 2015 The gocql Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/metadata_cassandra_test.go b/metadata_cassandra_test.go index cea77dafa..aef27594d 100644 --- a/metadata_cassandra_test.go +++ b/metadata_cassandra_test.go @@ -1,5 +1,5 @@ -// +build cassandra -// +build !scylla +//go:build cassandra && !scylla +// +build cassandra,!scylla // Copyright (c) 2015 The gocql Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/metadata_scylla.go b/metadata_scylla.go index c413d97c0..b675b6c8c 100644 --- a/metadata_scylla.go +++ b/metadata_scylla.go @@ -244,7 +244,7 @@ type schemaDescriber struct { session *Session mu sync.Mutex - cache map[string]*KeyspaceMetadata + cache map[string]*KeyspaceMetadata // Experimental, this interface and use may change tabletsCache *TabletsMetadata diff --git a/metadata_scylla_test.go b/metadata_scylla_test.go index 2accc3166..ae541ed9f 100644 --- a/metadata_scylla_test.go +++ b/metadata_scylla_test.go @@ -1,3 +1,4 @@ +//go:build !cassandra // +build !cassandra // Copyright (c) 2015 The gocql Authors. All rights reserved. diff --git a/recreate.go b/recreate.go index 64a4a20bb..045fd3a0f 100644 --- a/recreate.go +++ b/recreate.go @@ -1,4 +1,6 @@ +//go:build !cassandra // +build !cassandra + // Copyright (C) 2017 ScyllaDB package gocql @@ -494,12 +496,12 @@ type scyllaEncryptionOptions struct { // UnmarshalBinary deserializes blob into scyllaEncryptionOptions. // Format: -// * 4 bytes - size of KV map -// Size times: -// * 4 bytes - length of key -// * len_of_key bytes - key -// * 4 bytes - length of value -// * len_of_value bytes - value +// - 4 bytes - size of KV map +// Size times: +// - 4 bytes - length of key +// - len_of_key bytes - key +// - 4 bytes - length of value +// - len_of_value bytes - value func (enc *scyllaEncryptionOptions) UnmarshalBinary(data []byte) error { size := binary.LittleEndian.Uint32(data[0:4]) diff --git a/recreate_test.go b/recreate_test.go index ee6976deb..b1df27690 100644 --- a/recreate_test.go +++ b/recreate_test.go @@ -1,5 +1,5 @@ -//+build integration -//+build scylla +//go:build integration && scylla +// +build integration,scylla // Copyright (C) 2017 ScyllaDB diff --git a/scylla.go b/scylla.go index 54e00a9e4..803c73542 100644 --- a/scylla.go +++ b/scylla.go @@ -378,13 +378,13 @@ func (p *scyllaConnPicker) Pick(t token, keyspace string, table string) *Conn { conn.mu.Lock() if conn.tabletsRoutingV1 { tablets := conn.session.getTablets() - + // Search for tablets with Keyspace and Table from the Query l, r := findTablets(tablets, keyspace, table) - + if l != -1 { tablet := findTabletForToken(tablets, mmt, l, r) - + for _, replica := range tablet.replicas { if replica.hostId.String() == p.hostId { idx = replica.shardId @@ -396,7 +396,7 @@ func (p *scyllaConnPicker) Pick(t token, keyspace string, table string) *Conn { break } - + if idx == -1 { idx = p.shardOf(mmt) } @@ -415,7 +415,7 @@ func (p *scyllaConnPicker) maybeReplaceWithLessBusyConnection(c *Conn) *Conn { return c } alternative := p.leastBusyConn() - if alternative == nil || alternative.AvailableStreams() * 120 > c.AvailableStreams() * 100 { + if alternative == nil || alternative.AvailableStreams()*120 > c.AvailableStreams()*100 { return c } else { return alternative @@ -423,7 +423,7 @@ func (p *scyllaConnPicker) maybeReplaceWithLessBusyConnection(c *Conn) *Conn { } func isHeavyLoaded(c *Conn) bool { - return c.streams.NumStreams / 2 > c.AvailableStreams(); + return c.streams.NumStreams/2 > c.AvailableStreams() } func (p *scyllaConnPicker) leastBusyConn() *Conn { diff --git a/scylla_shard_aware_port_integration_test.go b/scylla_shard_aware_port_integration_test.go index 422d750c0..47c0b4066 100644 --- a/scylla_shard_aware_port_integration_test.go +++ b/scylla_shard_aware_port_integration_test.go @@ -1,5 +1,5 @@ -// +build integration -// +build scylla +//go:build integration && scylla +// +build integration,scylla package gocql diff --git a/scylla_shard_aware_port_mocked_test.go b/scylla_shard_aware_port_mocked_test.go index 7c031aec0..38c447fc2 100644 --- a/scylla_shard_aware_port_mocked_test.go +++ b/scylla_shard_aware_port_mocked_test.go @@ -1,3 +1,4 @@ +//go:build unit // +build unit package gocql diff --git a/session.go b/session.go index 6bdfb8873..345e27742 100644 --- a/session.go +++ b/session.go @@ -2171,10 +2171,10 @@ type routingKeyInfoLRU struct { } type routingKeyInfo struct { - indexes []int - types []TypeInfo - keyspace string - table string + indexes []int + types []TypeInfo + keyspace string + table string lwt bool partitioner partitioner }