Skip to content

Commit

Permalink
salt does not need -
Browse files Browse the repository at this point in the history
  • Loading branch information
aiq committed Feb 16, 2022
1 parent 7898c84 commit 539edb3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Reader.Read_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ ro/CU6vIqkOSNRUrNYDwqz1g3Z3eAQB/8t9Y4WsV4KL0M229rsFrtl26i7+quYfg
uuTd
=WxK9
-----END PGP MESSAGE-----
//-XYZ- hello-world.h -->
//XYZ hello-world.h -->
//---------------------------------------------------------- hello-world.c --> X
// this is part of hello-world.c
#include<stdio.h>
Expand Down
7 changes: 5 additions & 2 deletions Writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (my *Writer) detectPattern(content string) string {
patt := []rune(my.Salt)
for {
pattStr := string(patt)
if !strings.Contains(content, "\n//-"+string(pattStr)+"-") {
if !strings.Contains(content, "\n//"+string(pattStr)) {
return pattStr
}
patt = append(patt, my.Alphabet[rand.Intn(len(my.Alphabet))])
Expand Down Expand Up @@ -121,7 +121,7 @@ func (my *Writer) writeHeader(h Header, nextPatt string) (n int, err error) {

marker := "// "
if len(my.prevPatt) > 0 {
marker = "//-" + my.prevPatt + "- "
marker = "//" + my.prevPatt
}
tmp, err = my.writer.WriteString(marker)
n += tmp
Expand Down Expand Up @@ -166,6 +166,9 @@ func (my *Writer) WriteChunk(c Chunk) (n int, err error) {
return n, err
}
tmp, err = my.writer.WriteString(c.Content)
if err != nil {
return n, err
}
n += tmp

err = my.writer.Flush()
Expand Down

0 comments on commit 539edb3

Please sign in to comment.