Skip to content

Commit 7d6aaf5

Browse files
committed
style(algorithms): pass golint
1 parent 00ce068 commit 7d6aaf5

File tree

60 files changed

+84
-84
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+84
-84
lines changed

algorithms/3sum/threeSum.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package three_sum
1+
package threesum
22

33
import "sort"
44

algorithms/3sum/threeSum_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package three_sum
1+
package threesum
22

33
import (
44
"testing"

algorithms/3sum_closest/threeSumClosest.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package three_sum_closest
1+
package threesumclosest
22

33
import "sort"
44

algorithms/3sum_closest/threeSumClosest_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package three_sum_closest
1+
package threesumclosest
22

33
import (
44
"testing"

algorithms/4sum/fourSum.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package four_sum
1+
package foursum
22

33
import "sort"
44

algorithms/4sum/fourSum_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package four_sum
1+
package foursum
22

33
import (
44
"testing"

algorithms/add_two_numbers/addTwoNumbers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package add_two_numbers
1+
package addtwonumbers
22

33
// ListNode definition for singly-linked list.
44
type ListNode struct {

algorithms/add_two_numbers/addTwoNumbers_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package add_two_numbers
1+
package addtwonumbers
22

33
import (
44
"testing"

algorithms/container_with_most_water/maxArea.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package container_with_most_water
1+
package containerwithmostwater
22

33
func maxArea(height []int) int {
44
if hs := len(height); hs >= 2 {

algorithms/container_with_most_water/maxArea_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package container_with_most_water
1+
package containerwithmostwater
22

33
import (
44
"testing"

algorithms/divide_two_integers/divide.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package divide_two_integers
1+
package dividetwointegers
22

33
import "math"
44

algorithms/divide_two_integers/divide_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package divide_two_integers
1+
package dividetwointegers
22

33
import (
44
"math"

algorithms/generate_parentheses/generateParenthesis.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package generate_parentheses
1+
package generateparentheses
22

33
func generateParenthesis(n int) []string {
44
if n >= 1 {

algorithms/generate_parentheses/generateParenthesis_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package generate_parentheses
1+
package generateparentheses
22

33
import (
44
"testing"

algorithms/implement_strstr/strStr.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package implement_strstr
1+
package implementstrstr
22

33
func strStr(haystack string, needle string) int {
44
if hl, nl := len(haystack), len(needle); nl == 0 {

algorithms/implement_strstr/strStr_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package implement_strstr
1+
package implementstrstr
22

33
import (
44
"testing"
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
package integer_to_roman
1+
package integertoroman
22

33
var (
4-
M = [4]string{"", "M", "MM", "MMM"}
5-
C = [10]string{"", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"}
6-
X = [10]string{"", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"}
7-
I = [10]string{"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"}
4+
m = [4]string{"", "m", "MM", "MMM"}
5+
c = [10]string{"", "c", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"}
6+
x = [10]string{"", "x", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"}
7+
i = [10]string{"", "i", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"}
88
)
99

1010
func intToRoman(num int) string {
1111
if num >= 1 && num <= 3999 {
1212
if num >= 1000 {
13-
return M[num/1000] + C[(num%1000)/100] + X[(num%100)/10] + I[num%10]
13+
return m[num/1000] + c[(num%1000)/100] + x[(num%100)/10] + i[num%10]
1414
} else if num >= 100 {
15-
return C[num/100] + X[(num%100)/10] + I[num%10]
15+
return c[num/100] + x[(num%100)/10] + i[num%10]
1616
}
17-
return X[(num%100)/10] + I[num%10]
17+
return x[(num%100)/10] + i[num%10]
1818
}
1919
return ""
2020
}

algorithms/integer_to_roman/intToRoman_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package integer_to_roman
1+
package integertoroman
22

33
import (
44
"testing"

algorithms/letter_combinations_of_a_phone_number/letterCombinations.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package letter_combinations_of_a_phone_number
1+
package lettercombinationsofaphonenumber
22

3-
var charsmap [10]string = [10]string{"0", "1", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"}
3+
var charsmap = [10]string{"0", "1", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"}
44

55
func letterCombinations(digits string) []string {
66
if len(digits) == 0 {

algorithms/letter_combinations_of_a_phone_number/letterCombinations_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package letter_combinations_of_a_phone_number
1+
package lettercombinationsofaphonenumber
22

33
import (
44
"testing"

algorithms/longest_common_prefix/longestCommonPrefix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package longest_common_prefix
1+
package longestcommonprefix
22

33
func longestCommonPrefix(strs []string) string {
44
if len(strs) >= 1 {

algorithms/longest_common_prefix/longestCommonPrefix_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package longest_common_prefix
1+
package longestcommonprefix
22

33
import (
44
"testing"

algorithms/longest_palindromic_substring/longestPalindrome.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package longest_palindromic_substring
1+
package longestpalindromicsubstring
22

33
func longestPalindrome(s string) string {
44
if ls := len(s) - 1; ls >= 0 {

algorithms/longest_palindromic_substring/longestPalindrome_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package longest_palindromic_substring
1+
package longestpalindromicsubstring
22

33
import (
44
"testing"

algorithms/longest_substring_without_repeating_characters/lengthOfLongestSubstring.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package longest_substring_without_repeating_characters
1+
package longestsubstringwithoutrepeatingcharacters
22

33
func lengthOfLongestSubstring(s string) int {
44
if n := len(s); n >= 1 {

algorithms/longest_substring_without_repeating_characters/lengthOfLongestSubstring_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package longest_substring_without_repeating_characters
1+
package longestsubstringwithoutrepeatingcharacters
22

33
import (
44
"testing"

algorithms/median_of_two_sorted_arrays/findMedianSortedArrays.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package median_of_two_sorted_arrays
1+
package medianoftwosortedarrays
22

33
import "math"
44

@@ -16,7 +16,7 @@ func findMedianSortedArrays(nums1 []int, nums2 []int) float64 {
1616
odd := size%2 != 0 // bool, if size is odd.
1717
offset := size / 2 // middle index.
1818
if !odd {
19-
offset -= 1 // middle index if size is even.
19+
offset-- // middle index if size is even.
2020
}
2121

2222
var n1, n2 int

algorithms/median_of_two_sorted_arrays/findMedianSortedArrays_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package median_of_two_sorted_arrays
1+
package medianoftwosortedarrays
22

33
import (
44
"testing"

algorithms/merge_k_sorted_lists/mergeKLists.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package merge_k_sorted_lists
1+
package mergeksortedlists
22

33
// ListNode definition for singly-linked list.
44
type ListNode struct {

algorithms/merge_k_sorted_lists/mergeKLists_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package merge_k_sorted_lists
1+
package mergeksortedlists
22

33
import (
44
"testing"

algorithms/merge_two_sorted_lists/mergeTwoLists.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package merge_two_sorted_lists
1+
package mergetwosortedlists
22

33
// ListNode definition for singly-linked list.
44
type ListNode struct {

algorithms/merge_two_sorted_lists/mergeTwoLists_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package merge_two_sorted_lists
1+
package mergetwosortedlists
22

33
import (
44
"testing"

algorithms/palindrome_number/isPalindrome.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package palindrome_number
1+
package palindromenumber
22

33
func isPalindrome(x int) bool {
44
if x <= -1 {

algorithms/palindrome_number/isPalindrome_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package palindrome_number
1+
package palindromenumber
22

33
import (
44
"testing"

algorithms/regular_expression_matching/isMatch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package regular_expression_matching
1+
package regularexpressionmatching
22

33
func isMatch(s string, p string) bool {
44
if s != p {

algorithms/regular_expression_matching/isMatch_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package regular_expression_matching
1+
package regularexpressionmatching
22

33
import (
44
"testing"

algorithms/remove_duplicates_from_sorted_array/removeDuplicates.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package remove_duplicates_from_sorted_array
1+
package removeduplicatesfromsortedarray
22

33
func removeDuplicates(nums []int) int {
44
if len(nums) >= 2 {

algorithms/remove_duplicates_from_sorted_array/removeDuplicates_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package remove_duplicates_from_sorted_array
1+
package removeduplicatesfromsortedarray
22

33
import (
44
"testing"

algorithms/remove_element/removeElement.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package remove_element
1+
package removeelement
22

33
func removeElement(nums []int, val int) int {
44
length := 0

algorithms/remove_element/removeElement_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package remove_element
1+
package removeelement
22

33
import (
44
"testing"

algorithms/remove_nth_node_from_end_of_list/removeNthFromEnd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package remove_nth_node_from_end_of_list
1+
package removenthnodefromendoflist
22

33
// ListNode definition for singly-linked list.
44
type ListNode struct {

algorithms/remove_nth_node_from_end_of_list/removeNthFromEnd_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package remove_nth_node_from_end_of_list
1+
package removenthnodefromendoflist
22

33
import (
44
"testing"

algorithms/reverse_integer/reverse.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package reverse_integer
1+
package reverseinteger
22

33
import "math"
44

algorithms/reverse_integer/reverse_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package reverse_integer
1+
package reverseinteger
22

33
import (
44
"math"

algorithms/reverse_nodes_in_k_group/reverseKGroup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package reverse_nodes_in_k_group
1+
package reversenodesinkgroup
22

33
// ListNode definition for singly-linked list.
44
type ListNode struct {

algorithms/reverse_nodes_in_k_group/reverseKGroup_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package reverse_nodes_in_k_group
1+
package reversenodesinkgroup
22

33
import (
44
"testing"

algorithms/roman_to_integer/romanToInt.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package roman_to_integer
1+
package romantointeger
22

33
func romanToInt(s string) int {
44
if l := len(s); l >= 1 {
@@ -24,7 +24,7 @@ func romanToInt(s string) int {
2424
result += 5
2525
current = 2
2626
default: // 'I'
27-
result += 1
27+
result++
2828
current = 1
2929
}
3030
if last != 0 && last < current {

algorithms/roman_to_integer/romanToInt_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package roman_to_integer
1+
package romantointeger
22

33
import (
44
"testing"

algorithms/string_to_integer_atoi/myAtoi.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package string_to_integer_atoi
1+
package stringtointegeratoi
22

33
import "math"
44

algorithms/string_to_integer_atoi/myAtoi_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package string_to_integer_atoi
1+
package stringtointegeratoi
22

33
import (
44
"testing"

0 commit comments

Comments
 (0)