Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Omitempty prevents setting replace_original to false #1063

Closed
wojtkiewicz opened this issue May 16, 2022 · 1 comment
Closed

Omitempty prevents setting replace_original to false #1063

wojtkiewicz opened this issue May 16, 2022 · 1 comment
Labels
bug [issue] bug Web API

Comments

@wojtkiewicz
Copy link

wojtkiewicz commented May 16, 2022

What happened

At the moment it's impossible to send replace_original: false in WebhookMessage because of omitempty.
This would be fine if replace_original was set to false by default. Unfortunately it's not.

Expected behavior

It should be possible to set replace_original: false from slack-go.

Steps to reproduce

import (
	"encoding/json"
	"fmt"
)

type WebhookMessage struct {
	ReplaceOriginal bool `json:"replace_original,omitempty"`
}

func main() {
        msg := &WebhookMessage{
		ReplaceOriginal: false,
	}
	out, _ := json.Marshal(msg)
	fmt.Println(string(out))
}

// produces {}

Versions

  • Go: any
  • slack-go/slack: 0.10.3
@wojtkiewicz wojtkiewicz changed the title Omitempty prevents setting replace_origin to false Omitempty prevents setting replace_original to false May 16, 2022
@kanata2 kanata2 added bug [issue] bug Web API labels May 17, 2022
@kanata2
Copy link
Member

kanata2 commented Nov 4, 2022

Resolved by #1122

@kanata2 kanata2 closed this as completed Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [issue] bug Web API
Projects
None yet
Development

No branches or pull requests

2 participants