-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Version of SDK updated. Package updated * Update examples * Use system staticcheck --------- Co-authored-by: Ivan Kamkin <[email protected]>
- Loading branch information
1 parent
bb7a23f
commit f6811c9
Showing
12 changed files
with
164 additions
and
96 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
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
File renamed without changes.
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 |
---|---|---|
|
@@ -4,4 +4,3 @@ set -euo pipefail | |
go get -v -t -d ./... | ||
# Versions compatible with Go 1.17 | ||
go install golang.org/x/tools/cmd/[email protected] | ||
go install honnef.co/go/tools/cmd/[email protected] |
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,8 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" | ||
|
||
go run "${SCRIPT_DIR}/insert-examples.go" | ||
|
||
rm "README.template" |
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,46 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"regexp" | ||
) | ||
|
||
func main() { | ||
templateContent, err := os.ReadFile("README.template") | ||
if err != nil { | ||
fmt.Println("Error reading README.template file:", err) | ||
panic(err) | ||
} | ||
|
||
// Replace %insert path/to/file.go% with the content of the file | ||
re := regexp.MustCompile(`%insert ([^%]+)%`) | ||
|
||
// Replace the placeholders with the file contents | ||
result := re.ReplaceAllFunc(templateContent, func(match []byte) []byte { | ||
// Extract the file path from the placeholder | ||
matches := re.FindSubmatch(match) | ||
if len(matches) < 2 { | ||
return match | ||
} | ||
filePath := string(matches[1]) | ||
|
||
// Read the content of the file to be inserted | ||
fileContent, err := os.ReadFile(filePath) | ||
if err != nil { | ||
fmt.Printf("Error reading file %s: %v\n", filePath, err) | ||
panic(err) | ||
} | ||
|
||
return fileContent | ||
}) | ||
|
||
// Write the result to a new file or overwrite the existing file | ||
err = os.WriteFile("README.md", result, 0644) | ||
if err != nil { | ||
fmt.Println("Error writing README.md file:", err) | ||
panic(err) | ||
} | ||
|
||
fmt.Println("README.md file created successfully.") | ||
} |
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 |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
set -euo pipefail | ||
|
||
go vet -v ./... | ||
"$(go env GOPATH)/bin/staticcheck" ./... | ||
staticcheck ./... |