Go language bytes. Equal () and reflect. The difference between deepequal ()

Source: Internet
Author: User
1.bytes. Equal (A []byte,b []byte) bool compares the length of a and B with the same bytes, and a nil parameter is the same as an empty slice. 2.reflect. Deepequal (x, y interface{}) booldeepequal feedback whether X and Y are deep equivalents. The specific basis is as follows
  • X and Y with nil or with Non-nil
  • X and y have the same length
  • X and Y point to the Entity object initialized by the same underlying array. (&x[0] = = &y[0])
Note: An empty slice of non-nil and a nil slice are not deep equivalents. For example ([]byte{} and []byte{nil}) are non-equivalent. Other values: Numbers,bools,strings and channels are deep equivalents if they use "= =" for equality.

Go language bytes. Equal () and reflect. The difference between deepequal ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.