Skip to content

Commit

Permalink
make sure current code is not crashing even when compiled with
Browse files Browse the repository at this point in the history
-gcflags=all=-d=checkptr

flag (see https://golang.org/issues/34964 for details).

Verified with

go test ... --race

on both Windows and Linux.

Fixes #144
  • Loading branch information
alexbrainman committed Apr 26, 2020
1 parent fd264d0 commit f0492df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ start-mssql:
test-mssql:
go test -v -mssrv=localhost -msdb=$(DB_NAME) -msuser=sa -mspass=$(MSSQL_SA_PASSWORD) -run=TestMSSQL

test-mssql-race:
go test -v -mssrv=localhost -msdb=$(DB_NAME) -msuser=sa -mspass=$(MSSQL_SA_PASSWORD) -run=TestMSSQL --race

stop-mssql:
docker stop $(MSSQL_CONTAINER_NAME)
docker rm $(MSSQL_CONTAINER_NAME)
Expand Down
2 changes: 1 addition & 1 deletion column.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (c *BaseColumn) Value(buf []byte) (driver.Value, error) {
if p == nil {
return buf, nil
}
s := (*[1 << 28]uint16)(p)[:len(buf)/2]
s := (*[1 << 28]uint16)(p)[: len(buf)/2 : len(buf)/2]
return utf16toutf8(s), nil
case api.SQL_C_TYPE_TIMESTAMP:
t := (*api.SQL_TIMESTAMP_STRUCT)(p)
Expand Down

0 comments on commit f0492df

Please sign in to comment.