docs: fill README.md (#1098)
Add info about github action. Make a search placeholder waiting for access to algolia docsearch.
This commit is contained in:
parent
7a4daa5347
commit
f920f77a38
1
.github/PULL_REQUEST_TEMPLATE.md
vendored
1
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -1 +0,0 @@
|
|||||||
Thank you for the pull request!
|
|
44
README.md
44
README.md
@ -1 +1,43 @@
|
|||||||
See the documentation in our website [golangci-lint.run](https://golangci-lint.run).
|
<a href=""><img src="" width="250px"></a>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img alt="golangci-lint logo" src="assets/go.png" height="150" />
|
||||||
|
<h3 align="center">golangci-lint</h3>
|
||||||
|
<p align="center">Fast linters runner for Go</p>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
`golangci-lint` is a fast Go linters runner. It runs linters in parallel, uses caching, supports `yaml` config, has integrations
|
||||||
|
with all major IDE and has dozens of linters included.
|
||||||
|
|
||||||
|
## Install `golangci-lint`
|
||||||
|
|
||||||
|
- [On my machine](https://golangci-lint.run/usage/install/#ci-installation);
|
||||||
|
- [On CI/CD systems](https://golangci-lint.run/usage/install/#local-installation).
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
Documentation is hosted at https://golangci-lint.run.
|
||||||
|
|
||||||
|
## Badges
|
||||||
|
|
||||||
|

|
||||||
|
[](/LICENSE)
|
||||||
|
[](https://github.com/golangci/golangci-lint/releases/latest)
|
||||||
|
[](https://hub.docker.com/r/golangci/golangci-lint)
|
||||||
|
[](https://somsubhra.com/github-release-stats/?username=golangci&repository=golangci-lint)
|
||||||
|
|
||||||
|
## Contributors
|
||||||
|
|
||||||
|
This project exists thanks to all the people who contribute.
|
||||||
|
|
||||||
|
<a href="https://github.com/golangci/golangci-lint/graphs/contributors">
|
||||||
|
<img src="https://contributors-img.web.app/image?repo=golangci/golangci-lint" />
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- TODO: use `allcontributors` -->
|
||||||
|
|
||||||
|
## Stargazers over time
|
||||||
|
|
||||||
|
[](https://starchart.cc/golangci/golangci-lint)
|
||||||
|
3
docs/src/components/SearchBar/README.md
Normal file
3
docs/src/components/SearchBar/README.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
The source code copy-pasted from [here](https://github.com/facebook/docusaurus/blob/master/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/).
|
||||||
|
|
||||||
|
Waiting for [the official component](https://github.com/algolia/docsearch/issues/689).
|
328
docs/src/components/SearchBar/algolia.css
Normal file
328
docs/src/components/SearchBar/algolia.css
Normal file
File diff suppressed because one or more lines are too long
120
docs/src/components/SearchBar/index.js
Normal file
120
docs/src/components/SearchBar/index.js
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import React, { useState, useRef, useCallback } from "react";
|
||||||
|
import classnames from "classnames";
|
||||||
|
|
||||||
|
import { useHistory } from "react-router-dom";
|
||||||
|
|
||||||
|
import "./styles.css";
|
||||||
|
|
||||||
|
const algolia = {
|
||||||
|
// TODO
|
||||||
|
};
|
||||||
|
|
||||||
|
const Search = (props) => {
|
||||||
|
const [algoliaLoaded, setAlgoliaLoaded] = useState(false);
|
||||||
|
const searchBarRef = useRef(null);
|
||||||
|
const history = useHistory();
|
||||||
|
|
||||||
|
function initAlgolia(focus) {
|
||||||
|
window.docsearch({
|
||||||
|
appId: algolia.appId,
|
||||||
|
apiKey: algolia.apiKey,
|
||||||
|
indexName: algolia.indexName,
|
||||||
|
inputSelector: "#search_input_react",
|
||||||
|
algoliaOptions: algolia.algoliaOptions,
|
||||||
|
// Override algolia's default selection event, allowing us to do client-side
|
||||||
|
// navigation and avoiding a full page refresh.
|
||||||
|
handleSelected: (_input, _event, suggestion) => {
|
||||||
|
// Use an anchor tag to parse the absolute url into a relative url
|
||||||
|
// Alternatively, we can use new URL(suggestion.url) but it's not supported in IE.
|
||||||
|
const a = document.createElement("a");
|
||||||
|
a.href = suggestion.url;
|
||||||
|
|
||||||
|
// Algolia use closest parent element id #__docusaurus when a h1 page title does
|
||||||
|
// not have an id, so we can safely remove it.
|
||||||
|
// See https://github.com/facebook/docusaurus/issues/1828 for more details.
|
||||||
|
const routePath =
|
||||||
|
`#__docusaurus` === a.hash
|
||||||
|
? `${a.pathname}`
|
||||||
|
: `${a.pathname}${a.hash}`;
|
||||||
|
history.push(routePath);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (focus) {
|
||||||
|
searchBarRef.current.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const loadAlgolia = (focus = true) => {
|
||||||
|
if (algoliaLoaded) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Promise.all([import("docsearch.js"), import("./algolia.css")]).then(
|
||||||
|
([{ default: docsearch }]) => {
|
||||||
|
setAlgoliaLoaded(true);
|
||||||
|
window.docsearch = docsearch;
|
||||||
|
initAlgolia(focus);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSearchIcon = useCallback(() => {
|
||||||
|
loadAlgolia();
|
||||||
|
|
||||||
|
if (algoliaLoaded) {
|
||||||
|
searchBarRef.current.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
props.handleSearchBarToggle(!props.isSearchBarExpanded);
|
||||||
|
}, [props.isSearchBarExpanded]);
|
||||||
|
|
||||||
|
const handleSearchInputBlur = useCallback(() => {
|
||||||
|
props.handleSearchBarToggle(!props.isSearchBarExpanded);
|
||||||
|
}, [props.isSearchBarExpanded]);
|
||||||
|
|
||||||
|
const handleSearchInput = useCallback((e) => {
|
||||||
|
const needFocus = e.type !== "mouseover";
|
||||||
|
|
||||||
|
loadAlgolia(needFocus);
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="navbar__search" key="search-box">
|
||||||
|
<span
|
||||||
|
aria-label="expand searchbar"
|
||||||
|
role="button"
|
||||||
|
className={classnames("search-icon", {
|
||||||
|
"search-icon-hidden": props.isSearchBarExpanded,
|
||||||
|
})}
|
||||||
|
onClick={handleSearchIcon}
|
||||||
|
onKeyDown={handleSearchIcon}
|
||||||
|
tabIndex={0}
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
id="search_input_react"
|
||||||
|
type="search"
|
||||||
|
placeholder="Search"
|
||||||
|
aria-label="Search"
|
||||||
|
className={classnames(
|
||||||
|
"navbar__search-input",
|
||||||
|
{ "search-bar-expanded": props.isSearchBarExpanded },
|
||||||
|
{ "search-bar": !props.isSearchBarExpanded }
|
||||||
|
)}
|
||||||
|
onMouseOver={handleSearchInput}
|
||||||
|
onFocus={handleSearchInput}
|
||||||
|
onBlur={handleSearchInputBlur}
|
||||||
|
ref={searchBarRef}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Search;
|
40
docs/src/components/SearchBar/styles.css
Normal file
40
docs/src/components/SearchBar/styles.css
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.search-icon {
|
||||||
|
background-image: var(--ifm-navbar-search-input-icon);
|
||||||
|
height: auto;
|
||||||
|
width: 24px;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 8px;
|
||||||
|
line-height: 32px;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: center;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-icon-hidden {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 360px) {
|
||||||
|
.search-bar {
|
||||||
|
width: 0 !important;
|
||||||
|
background: none !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
transition: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-bar-expanded {
|
||||||
|
width: 9rem !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-icon {
|
||||||
|
display: inline;
|
||||||
|
vertical-align: sub;
|
||||||
|
}
|
||||||
|
}
|
@ -11,7 +11,7 @@ import { IconContainer } from "lib/icons";
|
|||||||
[](https://hub.docker.com/r/golangci/golangci-lint)
|
[](https://hub.docker.com/r/golangci/golangci-lint)
|
||||||
[](https://somsubhra.com/github-release-stats/?username=golangci&repository=golangci-lint)
|
[](https://somsubhra.com/github-release-stats/?username=golangci&repository=golangci-lint)
|
||||||
|
|
||||||
`golangci-lint` is a linters aggregator.
|
`golangci-lint` is a Go linters aggregator.
|
||||||
|
|
||||||
Join our slack <IconContainer color="#1DA1F2"><FaSlack /></IconContainer> channel by [joining Gophers workspace](https://invite.slack.golangbridge.org/)
|
Join our slack <IconContainer color="#1DA1F2"><FaSlack /></IconContainer> channel by [joining Gophers workspace](https://invite.slack.golangbridge.org/)
|
||||||
and then [joining](https://gophers.slack.com/archives/CS0TBRKPC) channel [`#golangci-lint`](https://gophers.slack.com/archives/CS0TBRKPC).
|
and then [joining](https://gophers.slack.com/archives/CS0TBRKPC) channel [`#golangci-lint`](https://gophers.slack.com/archives/CS0TBRKPC).
|
||||||
@ -41,3 +41,15 @@ Short 1.5 min video demo of analyzing [beego](https://github.com/astaxie/beego).
|
|||||||
## License Scan
|
## License Scan
|
||||||
|
|
||||||
[](https://app.fossa.io/projects/git%2Bgithub.com%2Fgolangci%2Fgolangci-lint?ref=badge_large)
|
[](https://app.fossa.io/projects/git%2Bgithub.com%2Fgolangci%2Fgolangci-lint?ref=badge_large)
|
||||||
|
|
||||||
|
## Contributors
|
||||||
|
|
||||||
|
This project exists thanks to all the people who contribute.
|
||||||
|
|
||||||
|
[](https://github.com/golangci/golangci-lint/graphs/contributors)
|
||||||
|
|
||||||
|
<!-- TODO: use `allcontributors` -->
|
||||||
|
|
||||||
|
## Stargazers over time
|
||||||
|
|
||||||
|
[](https://starchart.cc/golangci/golangci-lint)
|
||||||
|
BIN
docs/src/docs/usage/install/annotations.png
Normal file
BIN
docs/src/docs/usage/install/annotations.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 145 KiB |
@ -2,9 +2,23 @@
|
|||||||
title: "Install"
|
title: "Install"
|
||||||
---
|
---
|
||||||
|
|
||||||
## Binary
|
## CI installation
|
||||||
|
|
||||||
Most installations are done for CI (e.g. Travis CI, CircleCI). It's important to have reproducible CI:
|
Most installations of `golangci-lint` are performed for CI.
|
||||||
|
|
||||||
|
### GitHub Actions
|
||||||
|
|
||||||
|
We recommend using [our GitHub Action](https://github.com/golangci/golangci-lint-action) for running `golangci-lint` in CI for GitHub projects.
|
||||||
|
It's [fast and uses smart caching](https://github.com/golangci/golangci-lint-action#performance) inside
|
||||||
|
and it can be much faster than simple binary installation.
|
||||||
|
|
||||||
|
Also, the action creates GitHub annotations for found issues: you don't need to dig into build log to see found by `golangci-lint` issues:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Other CI
|
||||||
|
|
||||||
|
It's important to have reproducible CI:
|
||||||
don't start to fail all builds at the same time. With golangci-lint this can happen if you
|
don't start to fail all builds at the same time. With golangci-lint this can happen if you
|
||||||
use deprecated option `--enable-all` and a new linter is added or even without `--enable-all`: when one upstream linter is upgraded.
|
use deprecated option `--enable-all` and a new linter is added or even without `--enable-all`: when one upstream linter is upgraded.
|
||||||
|
|
||||||
@ -28,7 +42,9 @@ golangci-lint --version
|
|||||||
It is advised that you periodically update version of golangci-lint as the project is under active development
|
It is advised that you periodically update version of golangci-lint as the project is under active development
|
||||||
and is constantly being improved. For any problems with golangci-lint, check out recent [GitHub issues](https://github.com/golangci/golangci-lint/issues) and update if needed.
|
and is constantly being improved. For any problems with golangci-lint, check out recent [GitHub issues](https://github.com/golangci/golangci-lint/issues) and update if needed.
|
||||||
|
|
||||||
## macOS
|
## Local Installation
|
||||||
|
|
||||||
|
### macOS
|
||||||
|
|
||||||
You can also install a binary release on macOS using [brew](https://brew.sh/):
|
You can also install a binary release on macOS using [brew](https://brew.sh/):
|
||||||
|
|
||||||
@ -37,13 +53,13 @@ brew install golangci/tap/golangci-lint
|
|||||||
brew upgrade golangci/tap/golangci-lint
|
brew upgrade golangci/tap/golangci-lint
|
||||||
```
|
```
|
||||||
|
|
||||||
## Docker
|
### Docker
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:{.LatestVersion} golangci-lint run -v
|
docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:{.LatestVersion} golangci-lint run -v
|
||||||
```
|
```
|
||||||
|
|
||||||
## Go
|
### Install from Source
|
||||||
|
|
||||||
Go source installations are supported for the two most recent Go releases.
|
Go source installations are supported for the two most recent Go releases.
|
||||||
|
|
@ -58,3 +58,7 @@ source ~/.bashrc
|
|||||||
### Linux
|
### Linux
|
||||||
|
|
||||||
See [kubectl instructions](https://kubernetes.io/docs/tasks/tools/install-kubectl/#enabling-shell-autocompletion) and don't forget to replace `kubectl` with `golangci-lint`.
|
See [kubectl instructions](https://kubernetes.io/docs/tasks/tools/install-kubectl/#enabling-shell-autocompletion) and don't forget to replace `kubectl` with `golangci-lint`.
|
||||||
|
|
||||||
|
## CI Integration
|
||||||
|
|
||||||
|
See our [GitHub Action](/usage/install#github-actions).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user