Skip to content

Commit 925fe64

Browse files
committed
initial update
1 parent 3deec0e commit 925fe64

File tree

11 files changed

+1187
-2
lines changed

11 files changed

+1187
-2
lines changed

.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, built with `go test -c`
9+
*.test
10+
11+
# Output of the go coverage tool
12+
*.out
13+
14+
# Dependency directories
15+
vendor/
16+
17+
# Go workspace file
18+
go.work
19+
20+
# IDE
21+
.idea/
22+
.vscode/
23+
*.swp
24+
*.swo
25+
*~
26+
27+
# OS
28+
.DS_Store
29+
30+
# Build artifacts
31+
/examples/demo/demo
32+

QUICKSTART.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Quick Start Guide
2+
3+
Get started with the Go Release Conditions library in 5 minutes!
4+
5+
## Installation
6+
7+
```bash
8+
go get github.com/parthban-db/test-go-release
9+
```
10+
11+
## Common Use Cases
12+
13+
### 1. Check Go Version
14+
15+
```go
16+
import "github.com/parthban-db/test-go-release"
17+
18+
// Simple check
19+
if ok, _ := release.IsGoVersionAtLeast("1.20"); ok {
20+
// Use Go 1.20+ features
21+
}
22+
23+
// Get specific version components
24+
major, minor, _ := release.GetGoMajorMinor()
25+
if major >= 1 && minor >= 21 {
26+
// Use Go 1.21+ features
27+
}
28+
```
29+
30+
### 2. Platform Detection
31+
32+
```go
33+
// Check OS
34+
if release.IsOS("linux") {
35+
// Linux-specific code
36+
}
37+
38+
// Check architecture
39+
if release.IsArch("arm64") {
40+
// ARM64-specific code
41+
}
42+
43+
// Check specific platform
44+
if release.IsPlatform("darwin", "arm64") {
45+
// macOS Apple Silicon specific code
46+
}
47+
```
48+
49+
### 3. Build Information
50+
51+
```go
52+
info := release.GetBuildInfo()
53+
fmt.Printf("Go %s on %s\n", info.GoVersion, info.Platform)
54+
fmt.Printf("Built from commit: %s\n", info.VCSRevision)
55+
```
56+
57+
### 4. Release Validation
58+
59+
```go
60+
cs := release.NewConditionSet()
61+
62+
cs.Add("version", "Go 1.20+", func() (bool, error) {
63+
return release.IsGoVersionAtLeast("1.20")
64+
})
65+
66+
cs.Add("platform", "Supported platform", func() (bool, error) {
67+
return release.IsOS("linux") || release.IsOS("darwin"), nil
68+
})
69+
70+
results := cs.TestAll()
71+
if results.AllPassed() {
72+
fmt.Println("Ready for release!")
73+
}
74+
```
75+
76+
## Running the Demo
77+
78+
```bash
79+
cd examples/demo
80+
go run main.go
81+
```
82+
83+
## Running Tests
84+
85+
```bash
86+
# Run all tests
87+
go test -v
88+
89+
# Run with coverage
90+
go test -cover
91+
92+
# Run benchmarks
93+
go test -bench=.
94+
```
95+
96+
## API Quick Reference
97+
98+
| Function | Description |
99+
|----------|-------------|
100+
| `GetBuildInfo()` | Get detailed build information |
101+
| `IsGoVersionAtLeast(v)` | Check if Go version >= v |
102+
| `CompareGoVersion(v)` | Compare current Go version with v |
103+
| `GetGoMajorMinor()` | Get major.minor version numbers |
104+
| `IsPlatform(os, arch)` | Check specific platform |
105+
| `IsOS(os)` | Check operating system |
106+
| `IsArch(arch)` | Check architecture |
107+
| `HasVCSInfo()` | Check if VCS info available |
108+
| `NewConditionSet()` | Create condition test set |
109+
110+
## Examples in Code
111+
112+
Check out:
113+
- `example_test.go` - Executable examples
114+
- `examples/demo/main.go` - Full demo application
115+
- `release_test.go` - Unit tests showing usage
116+
117+
## Need Help?
118+
119+
See the full [README.md](README.md) for complete documentation.
120+

0 commit comments

Comments
 (0)