Skip to content

Commit

Permalink
chore: update templates and improve docs (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
tprasadtp committed Dec 16, 2023
1 parent 8c8cc25 commit 721ed4a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 79 deletions.
91 changes: 24 additions & 67 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,20 @@ linters-settings:
SPDX-FileCopyrightText: {{ copyright }}
SPDX-License-Identifier: {{ license }}
gomoddirectives:
# Allow local `replace` directives.
# Default: false
replace-local: false
# List of allowed `replace` directives.
# Default: []
replace-allow-list: []
# Allow to not explain why the version has been retracted in the `retract` directives.
# Default: false
retract-allow-no-explanation: false
# Forbid the use of the `exclude` directives.
# Default: false
exclude-forbidden: false

gomodguard:
blocked:
# List of blocked modules.
Expand All @@ -126,27 +140,29 @@ linters-settings:

# Use stdlib or custom replacements.
- github.com/mitchellh/go-homedir:
reason: "Use stdlib provided os.UserHomeDir()."
reason: "Use os.UserHomeDir() from stdlib."

- github.com/hashicorp/go-multierror:
reason: "Use stdlib provided errors.Join() available in go 1.20."
reason: "Use errors.Join() from from stdlib."
- go.uber.org/multierr:
reason: "Use stdlib provided errors.Join() available in go 1.20."
reason: "Use errors.Join() from from stdlib."
- github.com/pkg/errors:
reason: "Use error wrapping available in stdlib"
reason: "Use error wrapping directive(%w) in stdlib"

# go 1.19 introduced New atomic types.
- go.uber.org/atomic:
reason: "Use sync/atomic from stdlib."

# Use log/slog from stdlib or github.com/tprasadtp/log
- github.com/hashicorp/go-hclog:
reason: "Use log/slog or github.com/tprasadtp/log package."
recommendations:
- "log/slog"
- "github.com/tprasadtp/log"
- github.com/rs/zerolog:
reason: "Use log/slog or github.com/tprasadtp/log package."
recommendations:
- "log/slog"
- "github.com/tprasadtp/log"
- github.com/sirupsen/logrus:
reason: "Use log/slog or github.com/tprasadtp/log package."
recommendations:
- "log/slog"
- "github.com/tprasadtp/log"
Expand All @@ -161,9 +177,7 @@ linters-settings:
recommendations:
- "github.com/tprasadtp/go-autotune"
- github.com/KimMachineGun/automemlimit:
reason: |
Does not support cgroups mounted at non standard location,
does not support memory.high and does not support Windows.
reason: "Does not support cgroups mounted at non standard location and does not support Windows."
recommendations:
- "github.com/tprasadtp/go-autotune"

Expand All @@ -178,63 +192,6 @@ linters-settings:
recommendations:
- "github.com/tprasadtp/go-githubapp"

# Hashicorp has changed their license to BUSL for most products.
# Libraries may not be under BUSL, but they directly or indirectly
# depend on BUSL licensed product.
# --------------------------------------------------------------------

# Hashicorp Terraform
- github.com/hashicorp/terraform-plugin-sdk:
reason: "Hashicorp terraform is no longer open source."
- github.com/hashicorp/terraform-cdk-go/cdktf:
reason: "Hashicorp terraform is no longer open source."
- github.com/hashicorp/go-tfe:
reason: "Hashicorp terraform is no longer open source."
- hashicorp/terraform-plugin-log:
reason: "Hashicorp terraform is no longer open source."

# Hashicorp Vault
- github.com/hashicorp/vault-client-go:
reason: "Hashicorp vault is no longer open source."
- github.com/hashicorp/vault/sdk:
reason: "Hashicorp vault is no longer open source."
- github.com/hashicorp/vault/api:
reason: "hashicorp vault is no longer open source."
- github.com/hashicorp/vault:
reason: "hashicorp vault is no longer open source."

# Hashicorp Consul
- github.com/hashicorp/consul/api:
reason: "Hashicorp consul is no longer open source."

# Hashicorp Nomad
- github.com/hashicorp/nomad/api:
reason: "Hashicorp nomad is no longer open source."

# Hashicorp Boundary
- github.com/hashicorp/boundary/api:
reason: "Hashicorp boundary is no longer open source."
- github.com/hashicorp/boundary/sdk:
reason: "Hashicorp boundary is no longer open source."
- github.com/hashicorp/boundary/plugins:
reason: "Hashicorp boundary is no longer open source."

# Hashicorp Packer
- github.com/hashicorp/packer-plugin-sdk:
reason: "Hashicorp packer is no longer open source."

# Elastic has changed their license to SSPL/ELv2 which is not
# open source for most of their products. Avoid them. Libraries
# may be under open source license, but they directly or indirectly
# depend on SSPL licensed product.
# --------------------------------------------------------------------

# Elastic libbeat/beats
- github.com/elastic/beats/libbeat:
reason: "Elastic beats is not open source."
- github.com/elastic/beats/v7/libbeat:
reason: "Elastic beats is not open source."

forbidigo:
# Forbid the following identifiers (list of regexp).
# Default: ["^(fmt\\.Print(|f|ln)|print|println)$"]
Expand Down
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@ cpu delegation is enabled by default for systemd [252 or later][b8df7f8].
For older versions, It needs to be enabled [manually](https://github.com/systemd/systemd/issues/12362#issuecomment-485762928).
This also affects rootless docker and podman.

As most production workloads use
kubernetes or system level units, this is not an issue in most cases. If you are
running rootless podman/docker and require CPUQuota to be applied to your workloads,
upgrade to a distribution which uses systemd 252 or later or manually delegate
cpu controller to systemd user instance.

## Requirements (Windows)

- Windows 10 20H2 or later
Expand All @@ -60,7 +54,7 @@ cpu controller to systemd user instance.
## Disabling Automatic Configuration

To disable automatic configuration at runtime (for compiled binaries),
Set `GO_AUTOTUNE` environment variable to `false` or `0`.
Set `GO_AUTOTUNE` environment variable to `0` or `false`.

## Incompatible Modules

Expand Down
9 changes: 4 additions & 5 deletions autotune.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@
// For Linux, cgroup memory limit [memory.max] is a hard memory limit and
// [memory.high] is a soft memory limit.
//
// For Windows [JOBOBJECT_EXTENDED_LIMIT_INFORMATION] is used to get
// For Windows, [JOBOBJECT_EXTENDED_LIMIT_INFORMATION] is used to get
// max allowed memory. Windows lacks the support for soft memory limits.
// [JOBOBJECT_EXTENDED_LIMIT_INFORMATION] defines per process(ProcessMemoryLimit)
// and per job memory limits(JobMemoryLimit). ProcessMemoryLimit is always preferred
// over JobMemoryLimit. Both are considered hard limits. See [QueryInformationJobObject]
// and [JOBOBJECT_EXTENDED_LIMIT_INFORMATION] for more information.
// over JobMemoryLimit. Both are considered hard limits.
//
// - If GOMEMLIMIT environment variable is specified, it is always used, and
// limits are ignored. If GOMEMLIMIT is invalid, go runtime may panic during
Expand Down Expand Up @@ -74,10 +73,10 @@
// This package MUST NOT be used with other packages which also tweak GOMAXPROCS
// or GOMEMLIMIT. Some known incompatible packages include,
//
// - [go.uber.org/autmaxprocs]
// - [go.uber.org/automaxprocs]
// - [github.com/KimMachineGun/automemlimit]
//
// For using custom init function see,
// For using custom init function or configuring manually see,
//
// - [github.com/tprasadtp/go-autotune/maxprocs] for configuring GOMAXPROCS.
// - [github.com/tprasadtp/go-autotune/memlimit] for configuring GOMEMLIMIT.
Expand Down

0 comments on commit 721ed4a

Please sign in to comment.