summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt <kurt.w.jung@gmail.com>2019-05-07 15:20:57 -0400
committerKurt <kurt.w.jung@gmail.com>2019-05-07 15:20:57 -0400
commit514e371ce761f71cf004bf0da3246824310b2e4f (patch)
tree57f04955359baf0b6e67caabb7ef751917a72e08
parent71267fb332989953c8b27ec9a31832767886c926 (diff)
Add command line goreportcard check; address ineffectual assignments called out by this tool
-rw-r--r--Makefile1
-rw-r--r--fpdf.go2
-rw-r--r--utf8fontfile.go8
-rw-r--r--util.go8
4 files changed, 5 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index b0a5e06..410c89e 100644
--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,7 @@ check :
golint .
go vet -all .
gofmt -s -l .
+ goreportcard-cli -v
README.md : doc/document.md
pandoc --read=markdown --write=gfm < $< > $@
diff --git a/fpdf.go b/fpdf.go
index 0195cd3..7bee6e5 100644
--- a/fpdf.go
+++ b/fpdf.go
@@ -3953,8 +3953,6 @@ func (f *Fpdf) generateCIDFontMap(font *fontDefType, LastRune int) {
}
interval = true
cidArray[rangeID].put("interval", 1)
- ui := 0
- ui = ui + 1
} else {
if interval {
// new range
diff --git a/utf8fontfile.go b/utf8fontfile.go
index 0894701..794bae2 100644
--- a/utf8fontfile.go
+++ b/utf8fontfile.go
@@ -377,7 +377,7 @@ func (utf *utf8FontFile) parseHHEATable() int {
}
func (utf *utf8FontFile) parseOS2Table() int {
- weightType := 0
+ var weightType int
scale := 1000.0 / float64(utf.fontElementSize)
if _, OK := utf.tableDescriptions["OS/2"]; OK {
utf.SeekTable("OS/2")
@@ -831,9 +831,9 @@ func (utf *utf8FontFile) getSymbols(originalSymbolIdx int, start *int, symbolSet
}
func (utf *utf8FontFile) parseHMTXTable(numberOfHMetrics, numSymbols int, symbolToChar map[int][]int, scale float64) {
+ var widths int
start := utf.SeekTable("hmtx")
arrayWidths := 0
- widths := 0
var arr []int
utf.CharWidths = make([]int, 256*256)
charCount := 0
@@ -863,8 +863,6 @@ func (utf *utf8FontFile) parseHMTXTable(numberOfHMetrics, numSymbols int, symbol
}
}
}
- // data := utf.getRange(start+numberOfHMetrics*4, numSymbols*2)
- // arr = unpackUint16Array(data)
diff := numSymbols - numberOfHMetrics
for pos := 0; pos < diff; pos++ {
symbol := pos + numberOfHMetrics
@@ -949,7 +947,7 @@ func (utf *utf8FontFile) generateSCCSDictionaries(runeCmapPosition int, symbolCh
for i := 0; i < segmentSize; i++ {
positions = append(positions, utf.readUint16())
}
- symbol := 0
+ var symbol int
for n := 0; n < segmentSize; n++ {
completePosition := completers[n] + 1
for char := beginners[n]; char < completePosition; char++ {
diff --git a/util.go b/util.go
index e96cdd8..3902500 100644
--- a/util.go
+++ b/util.go
@@ -344,7 +344,7 @@ func (pa *untypedKeyMap) getIndex(key interface{}) int {
//Put key=>value in PHP Array
func (pa *untypedKeyMap) put(key interface{}, value int) {
if key == nil {
- i := 0
+ var i int
for n := 0; ; n++ {
i = pa.getIndex(n)
if i < 0 {
@@ -419,14 +419,8 @@ func arrayMerge(arr1, arr2 *untypedKeyMap) *untypedKeyMap {
answer.valueSet = arr1.valueSet[:]
for i := 0; i < len(arr2.keySet); i++ {
if arr2.keySet[i] == "interval" {
- u := 0
- u = u + 1
if arr1.getIndex("interval") < 0 {
answer.put("interval", arr2.valueSet[i])
- } else {
-
- u := 0
- u = u + 1
}
} else {
answer.put(nil, arr2.valueSet[i])