gin-contrib / gin-contrib/static

[Feature request] Add slightly more documentation for the parameters in `static.LocalFile`

Open
#45 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
321
Forks
44
Avg merge
3d 3h
Merged PRs (30d)
2

Description

While the first parameter in static.LocalFile is obvious, the second one — dealing with directory index files — is not. Namely, it's not really obvious that false actually means "skip the index.html file on the root of this directory" (or something like that).

Please consider one of the following:

  1. Add a little more documentation explaining what this parameter is for, and in which cases it's best to leave it on false;
  2. Add two new constants, say, static.UseIndexHTML and static.SkipIndexHTML or something descriptive like that, which get set to true and false respectively (to avoid breaking earlier code).

(or consider both!)

It's far easier to understand what r.Use(static.Serve("/static"), static.LocalFile("/path/to/static/files", static.SkipIndexHTML)) means — especially when looking at code after several months or years without remembering what true and false do in this case :)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the static.LocalFile API and the static.Serve usage described in the issue. Clarify the second parameter's true and false behavior, and determine whether documentation, named constants, or both are appropriate. Done means a reader can understand the option without remembering its boolean meaning.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, documentation
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.