Skip to content

Commit 49e9f33

Browse files
authored
fix: remove unused ForcePrepend option from Go code (#2089)
1 parent 1efa2bb commit 49e9f33

File tree

10 files changed

+2
-109
lines changed

10 files changed

+2
-109
lines changed

docs/guide/getting-started.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,6 @@ export ASDF_DATA_DIR="/your/custom/data/dir"
325325
326326
`asdf` scripts need to be sourced **after** you have set your `$PATH` and **after** you have sourced your framework (oh-my-zsh etc).
327327
328-
::: warning
329-
On macOS, starting a Bash or Zsh shell automatically calls a utility called `path_helper`. `path_helper` can rearrange items in `PATH` (and `MANPATH`), causing inconsistent behavior for tools that require specific ordering. To workaround this, `asdf` on macOS defaults to forcibly adding its `PATH`-entries to the front (taking highest priority). This is controllable with the `ASDF_FORCE_PREPEND` variable.
330-
:::
331-
332328
Restart your shell so that `PATH` changes take effect. Opening a new terminal tab will usually do it.
333329
334330

docs/ja-jp/guide/getting-started.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,6 @@ export ASDF_DATA_DIR="/your/custom/data/dir"
322322
323323
`asdf`のスクリプトは、`$PATH`を設定した**あと**、かつ、使用中のフレームワーク(oh-my-zsh など)を呼び出した**あと**に記述する必要があります。
324324
325-
::: warning 警告
326-
macOSでは、BashまたはZSHシェルを起動すると、自動的に`path_helper`というユーティリティが呼び出されます。`path_helper``PATH`(および`MANPATH`)内の項目の順番を並び替えることができるため、特定の順序を必要とするツールの動作に一貫性が無くなってしまいます。これを回避するため、macOSで`asdf`を利用するときは強制的に`PATH`エントリの先頭に追加する(優先度を一番高くする)ようにしてください。これは、`ASDF_FORCE_PREPEND`環境変数で制御できます。
327-
:::
328-
329325
`PATH`の変更を反映するために、シェルを再起動してください。たいていの場合、ターミナルのタブを新たに開けばOKです。
330326
331327

docs/ja-jp/manage/configuration.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,6 @@ pre_foo_bar = echo Executing with args: $@
205205
- 未設定の場合: asdf構成ファイルの`concurrency`の値が使用されます。
206206
- 使用方法: `export ASDF_CONCURRENCY=32`
207207

208-
### `ASDF_FORCE_PREPEND`
209-
210-
`asdf`のShimやパスのディレクトリを`PATH`の先頭(最高優先度)に追加するかどうかを設定します。
211-
212-
- 未設定の場合: macOSでのデフォルト値は`yes`、その他のシステムでのデフォルト値は`no`です。
213-
- `yes`の場合: `asdf`ディレクトリを強制的に`PATH`の先頭に配置します。
214-
- `yes`以外の文字列を設定した場合: `asdf`ディレクトリを強制的に`PATH`の先頭に配置することは _しません_
215-
- Usage: `ASDF_FORCE_PREPEND=no . "<path-to-asdf-directory>/asdf.sh"`
216-
217208
## 完全な構成の例
218209

219210
下記のように、asdfをシンプルにセットアップしたとします:

docs/ko-kr/guide/getting-started.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,7 @@ export ASDF_DIR="/opt/asdf-vm"
361361

362362
:::
363363

364-
`asdf` 스크립트들은 `$PATH` 설정한 **이후에** 프레임워크 (oh-my-zsh 등) source **이후에** source 되어야 합니다.
365-
366-
::: 경고
367-
macOS에서, Bash 혹은 Zsh 셸 시작시에 자동적으로 `path_helper` 유틸리티를 실행시킵니다. `path_helper``PATH` (와 `MANPATH`)에 항목들을 재배열 시켜 특정 순서를 요구하는 툴들의 일관된 동작을 방해합니다. 이를 방지하기 위해, macOS에서 `asdf``PATH` 앞부분에 (가장 높은 우선순위) 강제로 추가합니다. 이는 `ASDF_FORCE_PREPEND`를 통해 변경가능합니다.
368-
:::
364+
`asdf` 스크립트들은 `$PATH` 설정한 **이후에** 프레임워크 (oh-my-zsh 등) source **이후에** source 되어야 합니다.
369365

370366
`PATH` 업데이트를 위해 셸을 재시작하세요. 새로운 터미널을 여는 경우 대부분 해결됩니다.
371367

docs/ko-kr/manage/configuration.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -211,15 +211,6 @@ pre_foo_bar = echo Executing with args: $@
211211
- 미설정 시: asdf 설정 `concurrency` 값이 사용됩니다.
212212
- 사용법: `export ASDF_CONCURRENCY=32`
213213

214-
### `ASDF_FORCE_PREPEND`
215-
216-
`PATH`의 맨 앞(최우선순위) 부분에 `asdf` shim과 경로 디렉토리를 추가할 것인지 여부.
217-
218-
- 미설정 시: 맥 운영체제에서, `yes`가 기본값; 다른 시스템에서는 `no`가 기본값
219-
- `yes`: `PATH`의 앞 부분에 `asdf` 디렉토리 강제 추가
220-
- `yes` 이외의 _다른_ 문자열: `PATH`의 앞 부분에 `asdf` 디렉토리 강제로 추가하지 _않음_
221-
- 사용법: `ASDF_FORCE_PREPEND=no . "<path-to-asdf-directory>/asdf.sh"`
222-
223214
## 전체 설정의 예시
224215

225216
다음을 이용한 간단한 asdf 설치는:

docs/manage/configuration.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,6 @@ Number of cores to use when compiling the source code. If set, this value takes
205205
- If Unset: the asdf config `concurrency` value is used.
206206
- Usage: `export ASDF_CONCURRENCY=32`
207207

208-
### `ASDF_FORCE_PREPEND`
209-
210-
Whether or not to prepend the `asdf` shims and path directories to the front-most (highest-priority) part of the `PATH`.
211-
212-
- If Unset: On macOS, defaults to `yes`; but on other systems, defaults to `no`
213-
- If `yes`: Force `asdf` directories to the front of the `PATH`
214-
- If set to any string _other_ than `yes`: Do _not_ force `asdf` directories to the front of the `PATH`
215-
- Usage: `ASDF_FORCE_PREPEND=no . "<path-to-asdf-directory>/asdf.sh"`
216-
217208
## Full Configuration Example
218209

219210
Following a simple asdf setup with:

internal/config/config.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
)
1717

1818
const (
19-
forcePrependDefault = false
2019
dataDirDefault = "~/.asdf"
2120
configFileDefault = "~/.asdfrc"
2221
defaultToolVersionsFilenameDefault = ".tool-versions"
@@ -40,8 +39,7 @@ type Config struct {
4039
DefaultToolVersionsFilename string `env:"ASDF_DEFAULT_TOOL_VERSIONS_FILENAME, overwrite"`
4140
// Unclear if this value will be needed with the golang implementation.
4241
// AsdfDir string
43-
DataDir string `env:"ASDF_DATA_DIR, overwrite"`
44-
ForcePrepend bool
42+
DataDir string `env:"ASDF_DATA_DIR, overwrite"`
4543
// Field that stores the settings struct if it is loaded
4644
Settings Settings
4745
PluginIndexURL string
@@ -61,13 +59,7 @@ type Settings struct {
6159
}
6260

6361
func defaultConfig(dataDir, configFile string) *Config {
64-
forcePrepend := forcePrependDefault
65-
forcePrependEnv := os.Getenv("ASDF_FORCE_PREPEND")
66-
if strings.ToLower(forcePrependEnv) == "yes" || (forcePrependEnv == "" && runtime.GOOS == "darwin") {
67-
forcePrepend = true
68-
}
6962
return &Config{
70-
ForcePrepend: forcePrepend,
7163
DataDir: dataDir,
7264
ConfigFile: configFile,
7365
DefaultToolVersionsFilename: defaultToolVersionsFilenameDefault,

internal/config/config_darwin_test.go

Lines changed: 0 additions & 17 deletions
This file was deleted.

internal/config/config_linux_test.go

Lines changed: 0 additions & 17 deletions
This file was deleted.

internal/config/config_test.go

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,6 @@ func TestLoadConfigEnv(t *testing.T) {
2424
assert.Zero(t, config.Home, "Shouldn't set Home property when loading config")
2525
}
2626

27-
func TestLoadConfigEnv_WithForcePrependEnv(t *testing.T) {
28-
t.Run("When ASDF_FORCE_PREPEND env given yes", func(t *testing.T) {
29-
t.Setenv("ASDF_FORCE_PREPEND", "yes")
30-
31-
config, _ := loadConfigEnv()
32-
33-
assert.True(t, config.ForcePrepend, "Then ForcePrepend property is true")
34-
})
35-
36-
t.Run("When ASDF_FORCE_PREPEND env given YES", func(t *testing.T) {
37-
t.Setenv("ASDF_FORCE_PREPEND", "YES")
38-
39-
config, _ := loadConfigEnv()
40-
41-
assert.True(t, config.ForcePrepend, "Then ForcePrepend property is true")
42-
})
43-
44-
t.Run("When ASDF_FORCE_PREPEND env given any string other than yes", func(t *testing.T) {
45-
t.Setenv("ASDF_FORCE_PREPEND", "no")
46-
47-
config, _ := loadConfigEnv()
48-
49-
assert.False(t, config.ForcePrepend, "Then ForcePrepend property is false")
50-
})
51-
}
52-
5327
func TestLoadSettings(t *testing.T) {
5428
t.Run("When given invalid path returns error", func(t *testing.T) {
5529
settings, err := loadSettings("./foobar")

0 commit comments

Comments
 (0)