explaingit

go-co-op/gocron

7,053GoAudience · developerComplexity · 2/5Setup · easy

TLDR

gocron is a Go library for running code automatically on a time-based schedule, hourly, daily, on weekdays, and so on, though this v1 branch is no longer maintained, the active version is v2.

Mindmap

mindmap
  root((gocron))
    What it does
      Time-based scheduling
      Background jobs
      Cron-style triggers
    Use cases
      Cleanup tasks
      Scheduled reports
      Data polling
    Tech stack
      Go
    Status
      v1 unmaintained
      v2 is current
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Schedule a database cleanup task to run automatically every night in your Go backend without a separate cron service

USE CASE 2

Trigger a report-generation function every weekday morning from within your Go application

USE CASE 3

Poll an external API on a fixed interval, such as every hour, using a time-based scheduler in Go

Tech stack

Go

Getting it running

Difficulty · easy Time to first run · 30min

This v1 branch is no longer maintained and accepts no new contributions, use the v2 branch of the same repository for active support.

In plain English

gocron is a job scheduling library written in Go. Job scheduling libraries let you run code automatically on a fixed schedule: for example, once every hour, at midnight each day, or on weekday mornings. This is a common requirement in backend applications that need to run cleanup tasks, send reports, pull in data from external sources, or do any other work triggered by time rather than by a user action. This repository started as a fork of an earlier open-source Go scheduling project. The description labels it as easy and fluent, which suggests it was built around an API designed to be readable and concise to write. The associated topics include cron, scheduler, clockwork, and golang-job-scheduling, all pointing to a library that follows standard time-based scheduling conventions. The README for this particular branch is extremely sparse. It contains only a single notice: the project officially moved to version 2 at a separate branch of the same GitHub repository. The version 1 branch documented here is no longer maintained, and no new contributions or pull requests are being accepted against it. No installation instructions, usage examples, configuration details, or API references remain in this branch README. If you are looking for an actively maintained Go scheduling library, the version 2 branch of gocron is the current supported version. The details of what version 2 offers are not described in this source.

Copy-paste prompts

Prompt 1
Using gocron v2 in Go, write a scheduler that runs a database cleanup function every night at 2 AM and logs how long it took.
Prompt 2
How do I set up gocron in my Go web server to run a background job every 30 minutes without blocking the main HTTP handler?
Prompt 3
Show me how to use gocron to schedule a task that runs on weekday mornings only, and how to stop it gracefully when the server shuts down.
Open on GitHub → Explain another repo

← go-co-op on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.