Coding
PromptBeginner5 minmarkdown
Markdown Converter
Agent skill for markdown-converter
7
Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.
Sign in to like and favorite skills
Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.
go mod tidygo build -v ./...go install go.uber.org/mock/mockgen@latestexport PATH=$PATH:$(go env GOPATH)/bin (add to shell profile)make mocksmake fmtmake test -- takes 50 seconds. NEVER CANCEL. Set timeout to 90+ seconds.make test_ci -- takes 50 seconds. NEVER CANCEL. Set timeout to 90+ seconds.make test_coverage -- takes 50 seconds. NEVER CANCEL. Set timeout to 90+ seconds.go test -v -race -count=1 ./...grep "^func [a-zA-Z]" example_test.go | sort -cmake lint -- MAY FAIL due to golangci-lint config compatibility issues. This is a known issue.go vet ./... and gofmt -d .make test before submitting changes. Tests must pass.make fmt to ensure proper formatting.make mocks if you change interface definitions.cd examples/elector && go run main.goSince this is a library, not an application, testing involves:
gocron.NewScheduler()JobDefinition typesexamples/ directory to ensure functionalityExample validation script:
package main import ( "fmt" "time" "github.com/go-co-op/gocron/v2" ) func main() { s, err := gocron.NewScheduler() if err != nil { panic(err) } j, err := s.NewJob( gocron.DurationJob(2*time.Second), gocron.NewTask(func() { fmt.Println("Working!") }), ) if err != nil { panic(err) } fmt.Printf("Job ID: %s\n", j.ID()) s.Start() time.Sleep(6 * time.Second) s.Shutdown() }
The CI will fail if:
make test_ci)example_test.go is incorrect. ├── README.md # Main documentation ├── CONTRIBUTING.md # Contribution guidelines ├── SECURITY.md # Security policy ├── Makefile # Build automation ├── go.mod # Go module definition ├── .github/ # GitHub workflows and configs ├── .golangci.yaml # Linting configuration ├── examples/ # Usage examples │ └── elector/ # Distributed elector example ├── mocks/ # Generated mock files ├── *.go # Library source files └── *_test.go # Test files
scheduler.go - Main scheduler implementationjob.go - Job definitions and scheduling logicexecutor.go - Job execution enginelogger.go - Logging interfaces and implementationsdistributed.go - Distributed scheduling supportmonitor.go - Job monitoring interfacesutil.go - Utility functionserrors.go - Error definitionsgo mod:
github.com/google/uuid - UUID generationgithub.com/jonboulle/clockwork - Time mocking for testsgithub.com/robfig/cron/v3 - Cron expression parsinggithub.com/stretchr/testify - Testing utilitiesgo.uber.org/goleak - Goroutine leak detection-race flag)go install go.uber.org/mock/mockgen@latestgo vet instead$(go env GOPATH)/bin is in PATHgo mod tidy to resolve dependenciesmake test: ~50 secondsmake test_coverage: ~50 secondsmake test_ci: ~50 secondsgo build: ~5 secondsmake mocks: ~2 secondsmake fmt: <1 second