Semantic Versioning v1.4.1 & v1.4.2

Is it possible to follow Semantic Versioning because with version v1.4.2, SetBackground has been deprecated. It was not with v1.4.1. And that doesn’t compliance with Semantic Versioning.

// SetBackground sets value for the Background field.
// Deprecated: This option has been deprecated in MongoDB version 4.2.

Hi Jerome,

Deprecation doesn’t represent a breaking change and therefore it aligns with the semantic versioning constraints. It’s a warning to users that this feature may be replaced or removed in a future major release.

Hello Joe,
Thanks for your reply. But this kind of modification forces us to modify our code because linter (e.g. golangci-lint) breaks our CI. We don’t expect this kind behavior just on patch revision (v1.4.1 -> v1.4.2).


SA1019: options.Index().SetBackground is deprecated: This option has been deprecated in MongoDB version 4.2.  (staticcheck)

Hello Joe,
By the way, please find the way that is compliance with Semantic Versioning to deprecate an API:

  1. Minor version Y (x.Y.z | x > 0) … MUST be incremented if any public API functionality is marked as deprecated.


That makes sense. I will flag back to the engineering team. Good catch.

1 Like


Hi @Jerome_LAFORGE,

This is related to the change in GODRIVER-1736. In driver version 1.4.1, the IndexOptions.Background struct field was marked as deprecated, but the deprecation notice did not follow the correct format required by linters such as staticcheck. As part of GODRIVER-1736, we fixed all of those notices. However, staticcheck also does not currently detect use of deprecated struct fields due to, so as part of GODRIVER-1736, we also deprecated the corresponding setter functions (e.g. SetBackground). Apologies if this had any unintended consequences for your application. We will do our best to make sure our deprecation notices comply with the correct format when they are first released going forward so we do not have to make these kinds of changes.

– Divjot


Hi @Divjot_Arora,
Thanks for your explanation and for your great driver.
Thanks for your work.


This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.