Skip to content

Conversation

@lukasmalkmus
Copy link
Contributor

Summary

Replaces the demo/ directory (mentioned in Contributing.md but removed in #42) with idiomatic Go examples that will appear on pkg.go.dev.

Changes

Added example_test.go with 5 examples:

  • Example() - Basic usage
  • Example_serialization() - Binary marshaling with error handling
  • Example_merge() - Merging sketches for distributed counting
  • Example_precision() - Comparing precision levels (p=14 vs p=16)
  • Example_insertHash() - Using pre-computed hash values

Updated Contributing.md to reference go test -run Example -v instead of the removed demo.

All examples use modern Go idioms (range over int, fmt.Appendf) and proper error handling (log.Fatal). Examples verified with go test and modernize tool.

Closes #55

Replace demo/ directory with idiomatic Go examples in example_test.go:
- Example() - basic usage
- Example_serialization() - binary marshaling with error handling
- Example_merge() - merging sketches for distributed counting
- Example_precision() - precision level trade-offs
- Example_insertHash() - using pre-computed hashes

All examples use modern Go idioms (range over int, fmt.Appendf) and
proper error handling (log.Fatal vs panic). Examples will appear on
pkg.go.dev automatically.

Updated Contributing.md to show how to run examples with go test.

Closes #55
@lukasmalkmus lukasmalkmus self-assigned this Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Where I can find a new Demo?

1 participant