Skip to content

Directory Permissions - Changed to use constants - #365

Merged
technoweenie merged 3 commits into
masterfrom
unknown repository
Jun 17, 2015
Merged

technoweenie merged 3 commits into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Jun 3, 2015

Copy link
Copy Markdown

I have updated the code to use constants in place of the 0755 along with a note about possibly using the umask of the system git-lfs is installed.

thpang added 2 commits June 2, 2015 23:48
Update to clean up the use of the 0755 value in the directory creation code. Also added comment about using the system's umask value in the future to better align created locations with that of the system's admin. Refactoring here should make updates easier in the future.

NOTE: Not sure about the actual syntax of Go and its ability to keep uint32 values true given their assignment as constants.
@rubyist

rubyist commented Jun 4, 2015

Copy link
Copy Markdown
Contributor

This looks good, but I think the comment about future use of umask should be left out. The umask should already be honored when creating files and directories via Go code. That is, we ask for 0755 but if the umask is set to something other than 0022 we won't get it.

One formatting nit-pick, I think we'd rather see related consts blocked together. Also Go code will generally camel case the names rather than use all caps. You can find counterexamples such as os.O_RDONLY or os.SEEK_SET and friends, but those are usually coming from POSIX or underlying system names. I think we'd want to camel case here, e.g.

const (
    TempDirPerms       = 0755
    LocalMediaDirPerms = 0755
    LocalLogDirPerms   = 0755
)

Thanks for the PR!

Update based on comments received from initial pull request. Changes have been made and resubmitting.
Comment thread lfs/lfs.go

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.

For now, there's no need to export these constants.

technoweenie added a commit that referenced this pull request Jun 17, 2015
@technoweenie
technoweenie merged commit 250e374 into git-lfs:master Jun 17, 2015
@technoweenie

Copy link
Copy Markdown
Contributor

@thpang67 Thanks, just merged this. I have some Go feedback for you, under the assumption that you're pretty new to Go in general:

We don't need to expose those values because they only matter to the internals of the lfs package. I made them lowercase to keep them private in 4eb1660.

I noticed that commit changed the spacing on the constants. I use the go-plus atom package to run goimports on every Go file after a save automatically. The project will also run script/fmt at the very start of every script/test or script/cibuild run too.

@ghost

ghost commented Jun 17, 2015

Copy link
Copy Markdown
Author

@technoweenie thanks for the information on the atom package. I have just started using atom and find it to be quite useful. I have added the go-plus package. Go is new to me. I am coming from many years of structured development and programming. Thanks again.

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