Make GoLinter happy

This commit is contained in:
Winni Neessen 2021-09-23 09:43:26 +02:00
parent 15bccc3c42
commit 8bf103b73c
3 changed files with 31 additions and 86 deletions

View file

@ -1,4 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module version="4"> <module type="WEB_MODULE" version="4">
<component name="Go" enabled="true" /> <component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module> </module>

View file

@ -4,12 +4,10 @@
<option name="autoReloadType" value="ALL" /> <option name="autoReloadType" value="ALL" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="4f2cb9e2-b3a4-4e84-b99e-efc626c48d46" name="Changes" comment=""> <list default="true" id="e32960c0-29e5-4669-9fc2-ef12314486ce" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/apg-go.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/apg-go.iml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/apg-go.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/apg-go.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmd/apg/apg.go" beforeDir="false" afterPath="$PROJECT_DIR$/cmd/apg/apg.go" afterDir="false" /> <change beforePath="$PROJECT_DIR$/config/config.go" beforeDir="false" afterPath="$PROJECT_DIR$/config/config.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/go.mod" beforeDir="false" afterPath="$PROJECT_DIR$/go.mod" afterDir="false" />
<change beforePath="$PROJECT_DIR$/go.sum" beforeDir="false" afterPath="$PROJECT_DIR$/go.sum" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -23,86 +21,40 @@
<component name="GoLibraries"> <component name="GoLibraries">
<option name="indexEntireGoPath" value="false" /> <option name="indexEntireGoPath" value="false" />
</component> </component>
<component name="ProjectId" id="1yRb7lIdCn8c4b6dwTlP2QjBzYh" /> <component name="ProjectId" id="1yX0zXHdpGPxqctARqJlfIL2eFe" />
<component name="ProjectLevelVcsManager"> <component name="ProjectViewState">
<OptionsSetting value="false" id="Update" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="true" />
<property name="configurable..is.expanded" value="false" /> <property name="configurable..is.expanded" value="false" />
<property name="configurable.GoLibrariesConfigurable.is.expanded" value="true" /> <property name="configurable.GoLibrariesConfigurable.is.expanded" value="true" />
<property name="go.formatter.settings.were.checked" value="true" /> <property name="go.formatter.settings.were.checked" value="true" />
<property name="go.import.settings.migrated" value="true" /> <property name="go.import.settings.migrated" value="true" />
<property name="go.modules.go.list.on.any.changes.was.set" value="true" /> <property name="go.modules.go.list.on.any.changes.was.set" value="true" />
<property name="settings.editor.selected.configurable" value="go.sdk" /> <property name="go.sdk.automatically.set" value="true" />
</component> <property name="last_opened_file_path" value="$USER_HOME$" />
<component name="RunManager" selected="Go Test.Run Tests"> <property name="settings.editor.selected.configurable" value="go.vgo" />
<configuration name="Run apg-go client" type="GoApplicationRunConfiguration" factoryName="Go Application">
<module name="apg-go" />
<working_directory value="$PROJECT_DIR$" />
<kind value="PACKAGE" />
<package value="github.com/wneessen/apg-go/cmd/apg" />
<directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$" />
<method v="2" />
</configuration>
<configuration default="true" type="GoApplicationRunConfiguration" factoryName="Go Application">
<module name="apg-go" />
<working_directory value="$PROJECT_DIR$" />
<kind value="FILE" />
<directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$" />
<method v="2" />
</configuration>
<configuration name="Run Benchmark" type="GoTestRunConfiguration" factoryName="Go Test">
<module name="apg-go" />
<working_directory value="$PROJECT_DIR$" />
<go_parameters value="-v" />
<kind value="PACKAGE" />
<package value="github.com/wneessen/apg-go/cmd/apg" />
<directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$" />
<framework value="gobench" />
<method v="2" />
</configuration>
<configuration name="Run Tests" type="GoTestRunConfiguration" factoryName="Go Test">
<module name="apg-go" />
<working_directory value="$PROJECT_DIR$" />
<go_parameters value="-v" />
<kind value="PACKAGE" />
<package value="github.com/wneessen/apg-go/cmd/apg" />
<directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$" />
<framework value="gotest" />
<method v="2" />
</configuration>
<configuration default="true" type="GoTestRunConfiguration" factoryName="Go Test">
<module name="apg-go" />
<working_directory value="$PROJECT_DIR$" />
<kind value="DIRECTORY" />
<directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$" />
<framework value="gotest" />
<method v="2" />
</configuration>
<list>
<item itemvalue="Go Build.Run apg-go client" />
<item itemvalue="Go Test.Run Tests" />
<item itemvalue="Go Test.Run Benchmark" />
</list>
</component> </component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" /> <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" /> <option name="version" value="3" />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
<option name="oldMeFiltersMigrated" value="true" /> <option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component> </component>
<component name="VgoProject"> <component name="VgoProject">
<integration-enabled>true</integration-enabled> <integration-enabled>true</integration-enabled>
</component> </component>
<component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/apg_go$TestGetRandNum_in_github_com_wneessen_apg_go__1_.out" NAME="TestGetRandNum in github.com/wneessen/apg.go (1) Coverage Results" MODIFIED="1616594443133" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="GoCoverage" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" />
<SUITE FILE_PATH="coverage/apg_go$BenchmarkGetRandNum_in_apg_go.out" NAME="BenchmarkGetRandNum in apg.go Coverage Results" MODIFIED="1616342745320" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="GoCoverage" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" />
<SUITE FILE_PATH="coverage/apg_go$Test_Application.out" NAME="Test Application Coverage Results" MODIFIED="1616765230426" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="GoCoverage" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" />
</component>
</project> </project>

View file

@ -110,10 +110,10 @@ func parseParams(config *Config) {
config.HumanReadable = false config.HumanReadable = false
} }
if config.UseUpperCase == false && if !config.UseUpperCase &&
config.UseLowerCase == false && !config.UseLowerCase &&
config.UseNumber == false && !config.UseNumber &&
config.UseSpecial == false { !config.UseSpecial {
log.Fatalf("No password mode set. Cannot generate password from empty character set.") log.Fatalf("No password mode set. Cannot generate password from empty character set.")
} }
@ -133,40 +133,28 @@ func parseNewStyleParams(config *Config) {
switch curParam { switch curParam {
case 'S': case 'S':
config.UseSpecial = true config.UseSpecial = true
break
case 's': case 's':
config.UseSpecial = false config.UseSpecial = false
break
case 'N': case 'N':
config.UseNumber = true config.UseNumber = true
break
case 'n': case 'n':
config.UseNumber = false config.UseNumber = false
break
case 'L': case 'L':
config.UseLowerCase = true config.UseLowerCase = true
break
case 'l': case 'l':
config.UseLowerCase = false config.UseLowerCase = false
break
case 'U': case 'U':
config.UseUpperCase = true config.UseUpperCase = true
break
case 'u': case 'u':
config.UseUpperCase = false config.UseUpperCase = false
break
case 'H': case 'H':
config.HumanReadable = true config.HumanReadable = true
break
case 'h': case 'h':
config.HumanReadable = false config.HumanReadable = false
break
case 'C': case 'C':
config.UseComplex = true config.UseComplex = true
break
case 'c': case 'c':
config.UseComplex = false config.UseComplex = false
break
default: default:
log.Fatalf("Unknown password style parameter: %q\n", string(curParam)) log.Fatalf("Unknown password style parameter: %q\n", string(curParam))
} }