enable wastedassign
Finds wasted assignment statements. Signed-off-by: Kai Xia <kaix+github@fastmail.com>
This commit is contained in:
parent
7d907cd6b0
commit
bcc13d1f9b
5 changed files with 4 additions and 6 deletions
|
|
@ -61,7 +61,6 @@ linters:
|
||||||
- unparam
|
- unparam
|
||||||
- usestdlibvars
|
- usestdlibvars
|
||||||
- usetesting
|
- usetesting
|
||||||
- wastedassign
|
|
||||||
- whitespace
|
- whitespace
|
||||||
settings:
|
settings:
|
||||||
errcheck:
|
errcheck:
|
||||||
|
|
|
||||||
|
|
@ -233,7 +233,7 @@ func (c *DiscordChannel) handleMessage(s *discordgo.Session, m *discordgo.Messag
|
||||||
if localPath != "" {
|
if localPath != "" {
|
||||||
localFiles = append(localFiles, localPath)
|
localFiles = append(localFiles, localPath)
|
||||||
|
|
||||||
transcribedText := ""
|
var transcribedText string
|
||||||
if c.transcriber != nil && c.transcriber.IsAvailable() {
|
if c.transcriber != nil && c.transcriber.IsAvailable() {
|
||||||
ctx, cancel := context.WithTimeout(c.getContext(), transcriptionTimeout)
|
ctx, cancel := context.WithTimeout(c.getContext(), transcriptionTimeout)
|
||||||
result, err := c.transcriber.Transcribe(ctx, localPath)
|
result, err := c.transcriber.Transcribe(ctx, localPath)
|
||||||
|
|
|
||||||
|
|
@ -265,7 +265,7 @@ func (c *TelegramChannel) handleMessage(ctx context.Context, message *telego.Mes
|
||||||
localFiles = append(localFiles, voicePath)
|
localFiles = append(localFiles, voicePath)
|
||||||
mediaPaths = append(mediaPaths, voicePath)
|
mediaPaths = append(mediaPaths, voicePath)
|
||||||
|
|
||||||
transcribedText := ""
|
var transcribedText string
|
||||||
if c.transcriber != nil && c.transcriber.IsAvailable() {
|
if c.transcriber != nil && c.transcriber.IsAvailable() {
|
||||||
transcriberCtx, cancel := context.WithTimeout(ctx, 30*time.Second)
|
transcriberCtx, cancel := context.WithTimeout(ctx, 30*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ func (p *GitHubCopilotProvider) Chat(
|
||||||
return nil, fmt.Errorf("provider closed")
|
return nil, fmt.Errorf("provider closed")
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := session.SendAndWait(ctx, copilot.MessageOptions{
|
resp, _ := session.SendAndWait(ctx, copilot.MessageOptions{
|
||||||
Prompt: string(fullcontent),
|
Prompt: string(fullcontent),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,10 +76,9 @@ func NewExecTool(workingDir string, restrict bool) *ExecTool {
|
||||||
func NewExecToolWithConfig(workingDir string, restrict bool, config *config.Config) *ExecTool {
|
func NewExecToolWithConfig(workingDir string, restrict bool, config *config.Config) *ExecTool {
|
||||||
denyPatterns := make([]*regexp.Regexp, 0)
|
denyPatterns := make([]*regexp.Regexp, 0)
|
||||||
|
|
||||||
enableDenyPatterns := true
|
|
||||||
if config != nil {
|
if config != nil {
|
||||||
execConfig := config.Tools.Exec
|
execConfig := config.Tools.Exec
|
||||||
enableDenyPatterns = execConfig.EnableDenyPatterns
|
enableDenyPatterns := execConfig.EnableDenyPatterns
|
||||||
if enableDenyPatterns {
|
if enableDenyPatterns {
|
||||||
denyPatterns = append(denyPatterns, defaultDenyPatterns...)
|
denyPatterns = append(denyPatterns, defaultDenyPatterns...)
|
||||||
if len(execConfig.CustomDenyPatterns) > 0 {
|
if len(execConfig.CustomDenyPatterns) > 0 {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue