-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1182 from retailnext/zstd-build-constraints
Fix build without cgo
- Loading branch information
Showing
4 changed files
with
34 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// +build cgo | ||
|
||
package sarama | ||
|
||
import "github.com/DataDog/zstd" | ||
|
||
func zstdDecompress(dst, src []byte) ([]byte, error) { | ||
return zstd.Decompress(dst, src) | ||
} | ||
|
||
func zstdCompressLevel(dst, src []byte, level int) ([]byte, error) { | ||
return zstd.CompressLevel(dst, src, level) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// +build !cgo | ||
|
||
package sarama | ||
|
||
import ( | ||
"errors" | ||
) | ||
|
||
var errZstdCgo = errors.New("zstd compression requires building with cgo enabled") | ||
|
||
func zstdDecompress(dst, src []byte) ([]byte, error) { | ||
return nil, errZstdCgo | ||
} | ||
|
||
func zstdCompressLevel(dst, src []byte, level int) ([]byte, error) { | ||
return nil, errZstdCgo | ||
} |