Skip to content

[Golang] fix(log.go): improve log directory retrieval logic - #1220

Merged
RongtongJin merged 1 commit into
apache:masterfrom
f1amingo:fix_log_dir
Apr 15, 2026
Merged

RongtongJin merged 1 commit into
apache:masterfrom
f1amingo:fix_log_dir

Conversation

@f1amingo

Copy link
Copy Markdown
Contributor

Fixed an issue where the user home directory could not be correctly retrieved in some cases. When os.UserHomeDir() fails, a safe fallback path to the /tmp directory is provided.

Fixed an issue where the user home directory could not be correctly retrieved in some cases. When `os.UserHomeDir()` fails, a safe fallback path to the `/tmp` directory is provided.

Change-Id: I1d4f3835e5f84c15459cef2b5aa7a389c4d1ca44

@guyinyou guyinyou left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@RongtongJin
RongtongJin merged commit 3cc5cdf into apache:master Apr 15, 2026
14 of 15 checks passed
terrancesli added a commit to terrancesli/rocketmq-clients that referenced this pull request May 15, 2026
Fixed an issue where the user home directory could not be correctly retrieved in some cases. When `os.UserHomeDir()` fails, a safe fallback path to the `/tmp` directory is provided.

Change-Id: I1d4f3835e5f84c15459cef2b5aa7a389c4d1ca44

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

Fixes a real bug: os.Getenv("user.home") is not a valid way to get the home directory in Go β€” the env var is HOME on Linux and USERPROFILE on Windows. os.UserHomeDir() is the correct cross-platform API. The fallback to /tmp is a sensible safety net.

Verdict: LGTM β€” clean, correct fix.


Automated review by "github-manager-bot"

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants