Skip to content

Conversation

@harikrishna-au
Copy link

@harikrishna-au harikrishna-au commented Oct 13, 2025

Implement comprehensive tagging system for awesome-go

  • Add optional tags for project categorization ([lib]/[app], [active]/[stalled]/[unmaintained])
  • Enhance site generator with tag parsing and validation
  • Update templates to display color-coded tag badges
  • Add CSS styling for visual tag distinction
  • Update documentation with tagging guidelines and examples
  • Add robust error handling for navigation structure parsing
  • Maintain full backwards compatibility with existing entries

Addresses issue #5823: Add tags to distinguish between libraries/applications and maintenance status

We want to ensure high quality of the packages. Make sure that you've checked the boxes below before sending a pull request.

Note: This PR implements a feature enhancement to the awesome-go infrastructure rather than adding a new package, so the package-specific requirements below don't apply to this contribution.

  • The repo documentation has a pkg.go.dev link. (N/A - This enhances awesome-go itself)
  • The repo documentation has a coverage service link. (N/A - This enhances awesome-go itself)
  • The repo documentation has a goreportcard link. (N/A - This enhances awesome-go itself)
  • The repo has a version-numbered release and a go.mod file. (N/A - This enhances awesome-go itself)
  • The repo has a continuous integration process that automatically runs tests that must pass before new pull requests are merged. (N/A - This enhances awesome-go itself)
  • Continuous integration is used to attempt to catch issues prior to releasing this package to end-users. (N/A - This enhances awesome-go itself)

Please provide some links to your package to ease the review

This contribution enhances the awesome-go repository infrastructure rather than adding a new package:

  • forge link: https://github.com/harikrishna-au/awesome-go (fork with implementation)
  • pkg.go.dev: (N/A - Infrastructure enhancement)
  • goreportcard.com: (N/A - Infrastructure enhancement)
  • coverage service link: (N/A - Infrastructure enhancement)

Pull Request content

This PR implements infrastructure improvements rather than adding packages:

  • The package has been added to the list in alphabetical order. (N/A - Feature enhancement)
  • The package has an appropriate description with correct grammar. (N/A - Feature enhancement)
  • As far as I know, the package has not been listed here before. (N/A - Feature enhancement)

Actual Changes Made:

  • Implemented comprehensive tagging system with validation
  • Enhanced site generator with tag parsing capabilities
  • Added visual styling for color-coded tag badges
  • Updated documentation with clear tagging guidelines
  • Maintained full backwards compatibility
  • Added robust error handling for parsing edge cases
  • All existing tests continue to pass

Category quality

Note that new categories can be added only when there are 3 packages or more.

This contribution doesn't add or modify package listings but enhances the infrastructure:

  • No packages were added or removed in this PR
  • All existing package listings remain unchanged and functional
  • The tagging system is optional and doesn't affect existing entries
  • Example tags were added to demonstrate the feature without changing functionality

Summary

This PR addresses issue #5823 by implementing a comprehensive tagging system that allows optional categorization of projects by type ([lib]/[app]) and maintenance status ([active]/[stalled]/[unmaintained]). The implementation includes:

Features

  • Optional tagging system with validation
  • Visual distinction through color-coded badges
  • Backwards compatibility - existing entries unaffected
  • Enhanced site generator with robust parsing
  • Comprehensive documentation updates

Technical Details

  • Tag parsing from markdown backticks: [lib] [active]
  • CSS styling with semantic color coding
  • Template integration for badge rendering
  • Error handling for navigation structure edge cases
  • Full test coverage maintained

Benefits

  • Better project categorization for users
  • Visual maintenance status indicators
  • Enhanced browsing experience
  • No breaking changes to existing workflow

Thanks for your PR, you're awesome! 😎

Summary by CodeRabbit

  • New Features

    • Optional per-item tags (project type and maintenance status) added; rendered as badges next to titles and descriptions moved to follow titles.
    • Categories with no links are now hidden.
  • Style

    • Colored tag badge styles added for quick visual scanning.
  • Documentation

    • README and CONTRIBUTING updated with a Tags section, usage examples (duplicated where helpful), guidance on ordering, and several entries annotated with tags.

- Add optional tags for project categorization ([lib]/[app], [active]/[stalled]/[unmaintained])
- Enhance site generator with tag parsing and validation
- Update templates to display color-coded tag badges
- Add CSS styling for visual tag distinction
- Update documentation with tagging guidelines and examples
- Add robust error handling for navigation structure parsing
- Maintain full backwards compatibility with existing entries

Addresses issue avelino#5823: Add tags to distinguish between libraries/applications and maintenance status
@github-actions
Copy link

Automated Quality Checks (from CONTRIBUTING minimum standards)

  • Repo: FAIL (missing semver release)
  • pkg.go.dev: missing
  • goreportcard: missing
  • coverage: missing

These checks are a best-effort automation and do not replace human review.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 13, 2025

Walkthrough

Adds optional inline tags for project type and maintenance status to CONTRIBUTING.md and README, extends parsing in main.go to extract tags into a new Link.Tags field, updates templates to render tag badges and title/description ordering, exposes an upper() template helper, and adds CSS for tag badges.

Changes

Cohort / File(s) Summary
Docs: Tag guidelines
CONTRIBUTING.md, README.md
Add documentation for optional per-item tags ([lib]/[app], [active]/[stalled]/[unmaintained]), examples, and update several README entries to include tags.
Model & parsing
main.go
Add Tags []string to Link; parse inline code-style [tag] elements, validate via isValidTag; adjust title/description extraction, navigation selectors, skip empty categories, register upper in template FuncMap; update imports.
Templates: category listing
tmpl/category-index.tmpl.html
Render link Title as anchor text, iterate and display tag badges, and show Description only if present (after tags).
Styles: tag badges
tmpl/assets/awesome-go.css
Add .tag base styles and variants .tag-lib, .tag-app, .tag-active, .tag-stalled, .tag-unmaintained; purely additive CSS for badge visuals.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Parser as main.go
  participant Template as tmpl/*
  participant CSS as awesome-go.css
  participant HTML as Output

  User->>Parser: build/run site
  Parser->>Parser: load README/CONTRIBUTING content
  Parser->>Parser: extractCategories() (try details-based selector, else ul-based)
  loop per category
    Parser->>Parser: extractCategory() → for each link
    Parser->>Parser: read link Title and URL
    Parser->>Parser: collect inline code elements matching `[tag]`
    Parser->>Parser: isValidTag(tag) → append to Link.Tags
    Parser->>Parser: remove tag code from Description, trim
    Parser-->>Parser: assemble Link{Title,URL,Description,Tags}
  end
  Parser-->>Template: pass data (Categories with Links including Tags)
  Template->>Template: register func "upper"
  Template->>HTML: render Title, iterate Tags → output .tag badges, optionally show Description
  HTML->>CSS: apply .tag and variant styles
  User-->>HTML: view page with tag badges
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

A hop, a tag, a tidy trail—
I stamp [lib] on carrot mail.
Badges gleam where titles play,
Descriptions nibble at the fray.
I bound through lists with joyful tags, 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title “Implement comprehensive tagging system for project categorization” succinctly and accurately captures the primary change of introducing a tagging mechanism to classify projects by type and status, aligning directly with the scope of the pull request. It is concise, specific, and clearly reflects the main enhancement without extraneous details.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 75abb74 and a7e1856.

📒 Files selected for processing (5)
  • CONTRIBUTING.md (2 hunks)
  • README.md (3 hunks)
  • main.go (6 hunks)
  • tmpl/assets/awesome-go.css (1 hunks)
  • tmpl/category-index.tmpl.html (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.md

📄 CodeRabbit inference engine (AGENTS.md)

Keep documentation in English

Files:

  • CONTRIBUTING.md
  • README.md
README.md

📄 CodeRabbit inference engine (AGENTS.md)

README.md: When modifying the Awesome list, keep categories with at least three entries
Descriptions in the Awesome list must end with a period
Avoid promotional copy; keep descriptions concise and neutral in the Awesome list
Do not remove existing list content unless removal is requested and justified

Files:

  • README.md
{README.md,COVERAGE.md}

📄 CodeRabbit inference engine (AGENTS.md)

Align rendered documentation (README.md, COVERAGE.md, etc.) with behavior changes in main.go or helper packages

Files:

  • README.md
**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

**/*.go: Use standard formatting (gofmt) and idiomatic Go style
Favor small, testable functions in Go
Keep exported Go APIs documented with Go-style comments
Maintain ≥80% coverage for non-data packages and ≥90% for data packages when adding new testable Go code

Files:

  • main.go
{**/*.go,.github/scripts/**/*.js}

📄 CodeRabbit inference engine (AGENTS.md)

Use American English spelling in code comments

Files:

  • main.go
🪛 markdownlint-cli2 (0.18.1)
README.md

61-61: Spaces inside code span elements

(MD038, no-space-in-code)


61-61: Spaces inside code span elements

(MD038, no-space-in-code)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Codacy Static Code Analysis

- Preserve inline code like `net/http` when removing tag elements
- Fix WCAG AA contrast issues in CSS (.tag-lib and .tag-stalled)
- Fix markdown formatting in README example
- Add regexp import for tag pattern matching
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a7e1856 and 4adc3f9.

📒 Files selected for processing (3)
  • README.md (3 hunks)
  • main.go (6 hunks)
  • tmpl/assets/awesome-go.css (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
README.md

📄 CodeRabbit inference engine (AGENTS.md)

README.md: When modifying the Awesome list, keep categories with at least three entries
Descriptions in the Awesome list must end with a period
Avoid promotional copy; keep descriptions concise and neutral in the Awesome list
Do not remove existing list content unless removal is requested and justified

Files:

  • README.md
**/*.md

📄 CodeRabbit inference engine (AGENTS.md)

Keep documentation in English

Files:

  • README.md
{README.md,COVERAGE.md}

📄 CodeRabbit inference engine (AGENTS.md)

Align rendered documentation (README.md, COVERAGE.md, etc.) with behavior changes in main.go or helper packages

Files:

  • README.md
**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

**/*.go: Use standard formatting (gofmt) and idiomatic Go style
Favor small, testable functions in Go
Keep exported Go APIs documented with Go-style comments
Maintain ≥80% coverage for non-data packages and ≥90% for data packages when adding new testable Go code

Files:

  • main.go
{**/*.go,.github/scripts/**/*.js}

📄 CodeRabbit inference engine (AGENTS.md)

Use American English spelling in code comments

Files:

  • main.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (1)
tmpl/assets/awesome-go.css (1)

122-156: Tag palette meets accessibility.

Checked each foreground/background pair for .tag-*; all now clear the 4.5:1 AA threshold at 0.7 em. Nice cleanup.

- Replace broad regex pattern with precise isValidTag() validation
- Preserve legitimate inline code like [1], [gin], net/http
- Remove unused regexp import
- Ensure only approved tags ([lib], [app], [active], [stalled], [unmaintained]) are removed
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
main.go (1)

291-297: Critical: Strip brackets before validating tags.

Line 294 calls isValidTag(codeText) where codeText still includes the surrounding brackets (e.g., [lib]), but isValidTag expects the tag name without brackets (e.g., lib). This causes the validation to always fail, so no tag code elements are removed and tags remain visible in descriptions.

Apply this diff to strip brackets before validation:

 clonedLi.Find("code").Each(func(i int, codeEl *goquery.Selection) {
 	codeText := strings.TrimSpace(codeEl.Text())
-	if isValidTag(codeText) {
-		codeEl.Remove()
-	}
+	if len(codeText) > 2 && codeText[0] == '[' && codeText[len(codeText)-1] == ']' {
+		tag := strings.ToLower(strings.TrimSpace(codeText[1 : len(codeText)-1]))
+		if isValidTag(tag) {
+			codeEl.Remove()
+		}
+	}
 })
🧹 Nitpick comments (1)
main.go (1)

114-124: Consider extracting validTags to package level.

While functional, recreating the validTags map on every call adds minor overhead. Since the valid tags are constant, consider extracting it to a package-level variable for better performance in loops.

Apply this diff to move the map to package level:

+var validTags = map[string]bool{
+	"lib":          true,
+	"app":          true,
+	"active":       true,
+	"stalled":      true,
+	"unmaintained": true,
+}
+
 // isValidTag checks if a tag is in the allowed list
 func isValidTag(tag string) bool {
-	validTags := map[string]bool{
-		"lib":          true,
-		"app":          true,
-		"active":       true,
-		"stalled":      true,
-		"unmaintained": true,
-	}
 	return validTags[tag]
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4adc3f9 and eec674c.

📒 Files selected for processing (1)
  • main.go (6 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

**/*.go: Use standard formatting (gofmt) and idiomatic Go style
Favor small, testable functions in Go
Keep exported Go APIs documented with Go-style comments
Maintain ≥80% coverage for non-data packages and ≥90% for data packages when adding new testable Go code

Files:

  • main.go
{**/*.go,.github/scripts/**/*.js}

📄 CodeRabbit inference engine (AGENTS.md)

Use American English spelling in code comments

Files:

  • main.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (3)
main.go (3)

216-226: LGTM! Robust fallback logic.

The multi-selector approach with explicit error handling when no navigation structure is found is a solid improvement for gracefully handling different README structures.


275-288: LGTM! Tag extraction logic is correct.

The tag extraction correctly strips brackets, validates against the allowed list, and collects valid tags. The length check on line 282 prevents out-of-bounds slicing.


298-303: LGTM! Description extraction logic is sound.

The approach of removing the title prefix and leading dash from the cloned (tag-cleaned) text correctly isolates the description. TrimPrefix safely handles cases where the prefix is absent.

@harikrishna-au
Copy link
Author

@avelino @dukex
Quality Check Issue: The automated checks are failing because they expect package-specific links (pkg.go.dev, goreportcard), but this is an infrastructure enhancement to the site generator, not a Go package addition.

This PR: Implements a comprehensive tagging system for awesome-go (#5823) with full backwards compatibility, accessibility compliance, and production-ready code.

Request: Could I create a separate issue to fix the quality check script for infrastructure PRs, and then have this PR merged once that's addressed?

Copy link
Owner

@avelino avelino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea, but the [active] tag doesn't make sense
if the project is no longer active we should remove it from awesome-go - this is one of the biggest challenges in maintaining the project hehe

for your implementation to be accepted we need to "auto classify" all projects by adding tags, so it won't be just some projects with tags - we can use the Github API to help with this and extract the tags that the project maintainer added

@avelino avelino requested a review from phanirithvij October 13, 2025 09:22
@avelino
Copy link
Owner

avelino commented Oct 13, 2025

@phanirithvij what do you think about the implementation?

Copy link
Owner

avelino commented Oct 17, 2025

Hi @harikrishna-au, the automated checks for this PR failed. Please review the build logs and fix the issues. Specifically, the PR Quality Checks/quality-check failed. Please address this and re-request a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants