Skip to content

Commit 47cee78

Browse files
authored
Merge pull request #291 from libdns/pr/linter-and-cleanup-202509271110
Add: golangci-lint and related code cleanup
2 parents c6405c3 + cdce887 commit 47cee78

File tree

8 files changed

+803
-300
lines changed

8 files changed

+803
-300
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ jobs:
2020
with:
2121
go-version: 'stable'
2222

23+
24+
- name: golangci-lint
25+
uses: golangci/golangci-lint-action@v8
26+
with:
27+
version: v2.5
28+
2329
- name: Build
2430
run: go build -v ./...
2531

.golangci.yml

Lines changed: 464 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,42 @@ Route53 for `libdns`
55

66
This package implements the [libdns interfaces](https://github.com/libdns/libdns) for AWS [Route53](https://aws.amazon.com/route53/).
77

8+
## Example
9+
10+
```go
11+
package main
12+
13+
import (
14+
"context"
15+
"fmt"
16+
"time"
17+
18+
"github.com/libdns/route53"
19+
)
20+
21+
func main() {
22+
// greate a new Route53 provider instance
23+
provider := &route53.Provider{
24+
AccessKeyId: "YOUR_ACCESS_KEY_ID",
25+
SecretAccessKey: "YOUR_SECRET_ACCESS_KEY",
26+
Region: "us-east-1",
27+
}
28+
29+
ctx := context.Background()
30+
zone := "example.com."
31+
32+
// get all records for the zone
33+
records, err := provider.GetRecords(ctx, zone)
34+
if err != nil {
35+
panic(err)
36+
}
37+
38+
for _, record := range records {
39+
fmt.Printf("%s %s %s %d\n", record.Name, record.Type, record.Value, record.TTL/time.Second)
40+
}
41+
}
42+
```
43+
844
## Authenticating
945

1046
This package supports all the credential configuration methods described in the [AWS Developer Guide](https://aws.github.io/aws-sdk-go-v2/docs/configuring-sdk/#specifying-credentials), such as `Environment Variables`, `Shared configuration files`, the `AWS Credentials file` located in `.aws/credentials`, and `Static Credentials`. You may also pass in static credentials directly (or via caddy's configuration).
@@ -40,3 +76,27 @@ The following IAM policy is a minimal working example to give `libdns` permissio
4076
]
4177
}
4278
```
79+
80+
## Contributing
81+
82+
Contributions are welcome! Please ensure that:
83+
84+
1. All code passes `golangci-lint` checks. Run the following before committing:
85+
```bash
86+
golangci-lint run ./...
87+
```
88+
89+
2. All tests pass:
90+
```bash
91+
go test ./...
92+
```
93+
94+
3. For integration tests, set up the required environment variables:
95+
```bash
96+
export AWS_ACCESS_KEY_ID="your-key"
97+
export AWS_SECRET_ACCESS_KEY="your-secret"
98+
export ROUTE53_TEST_ZONE="test.example.com."
99+
cd libdnstest && go test -v
100+
```
101+
102+
Please fix any linter issues before submitting a pull request. The project maintains strict code quality standards to ensure maintainability.

0 commit comments

Comments
 (0)