change default package name

已完成

When I create a directory in a project, say my-awesome-directory, goland automatically generate first line for me:

package my-awesome-directory

And every time after that I have to rename it to

package myAwesomeDirectory

How to chage this default style?

1
正式评论

To achieve this, please perform the following steps:

1. Open "Preferences | Editor | File and Code Templates"

2. Select "Go File" in "Files" tab.

3. Replace the template text with the following:

```

#set($my_name = ${StringUtils.removeAndHump(${GO_PACKAGE_NAME}, "_")})
#set($my_name = $my_name.substring(0,1).toLowerCase() + $my_name.substring(1))
package $my_name

```

4. Apply the changes.

For more information, please see:
https://www.jetbrains.com/help/idea/using-file-and-code-templates.html

http://velocity.apache.org/

It works! Thank you

0

请先登录再写评论。